create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
pipe = pipeline("text-generation", model="TinyLlama/TinyLlama-1.1B-Chat-v1.0")
|
| 5 |
+
|
| 6 |
+
def chat(message, history):
|
| 7 |
+
response = pipe(message, max_new_tokens=256)
|
| 8 |
+
return response[0]['generated_text']
|
| 9 |
+
|
| 10 |
+
gr.ChatInterface(chat).launch()
|