Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
pipe = pipeline("text-generation", model="meta-llama/Meta-Llama-3-8B-Instruct")
|
| 5 |
+
|
| 6 |
+
def chat(prompt):
|
| 7 |
+
result = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7)
|
| 8 |
+
return result[0]['generated_text']
|
| 9 |
+
|
| 10 |
+
demo = gr.Interface(fn=chat, inputs="text", outputs="text")
|
| 11 |
+
demo.launch()
|