Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,13 +2,19 @@
|
|
| 2 |
|
| 3 |
#importing the required libraries including transformers
|
| 4 |
import gradio as gr
|
| 5 |
-
from
|
| 6 |
-
from transformers import pipeline, AutoModel, AutoTokenizer
|
| 7 |
|
| 8 |
-
|
| 9 |
-
messages = [
|
| 10 |
-
{"role": "user", "content": "Who are you?"},
|
| 11 |
-
]
|
| 12 |
-
pipe = pipeline("text-generation", model=model_name)
|
| 13 |
-
pipe(messages)
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
#importing the required libraries including transformers
|
| 4 |
import gradio as gr
|
| 5 |
+
from transformers import pipeline
|
|
|
|
| 6 |
|
| 7 |
+
def chat_response(prompt):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
model_name = "bmas10/ForJerry"
|
| 10 |
+
pipe = pipeline("text-generation", model=model_name)
|
| 11 |
+
messages = [{"role": "user", "content": prompt}]
|
| 12 |
+
return pipe(messages)
|
| 13 |
+
|
| 14 |
+
iface = gr.Interface(
|
| 15 |
+
fn=chat_response,
|
| 16 |
+
inputs=gr.Textbox(placeholder="Type your message here..."),
|
| 17 |
+
outputs=gr.Textbox()
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
iface.launch()
|