Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the model
|
5 |
+
chatbot = pipeline("text-generation", model="aisak-ai/aisak-assistant")
|
6 |
+
|
7 |
+
# Define the chat function
|
8 |
+
def chat_with_ai(prompt):
|
9 |
+
response = chatbot(prompt, max_length=50, num_return_sequences=1)
|
10 |
+
return response[0]['generated_text']
|
11 |
+
|
12 |
+
# Create the Gradio interface
|
13 |
+
interface = gr.Interface(fn=chat_with_ai, inputs="text", outputs="text")
|
14 |
+
|
15 |
+
# Launch the interface
|
16 |
+
interface.launch()
|