Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
generator = pipeline("text-generation", model="meta-llama/Llama-3-8B-Instruct")
|
| 5 |
+
|
| 6 |
+
def chat_with_ai(message):
|
| 7 |
+
output = generator(message, max_length=100, do_sample=True)
|
| 8 |
+
return output[0]['generated_text']
|
| 9 |
+
|
| 10 |
+
demo = gr.Interface(fn=chat_with_ai, inputs="text", outputs="text", title="TrainPy Assistant")
|
| 11 |
+
demo.launch()
|