Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,14 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
pipe = pipeline("text-generation", model="sapientinc/HRM-Text-1B")
|
| 5 |
-
tokenizer = AutoTokenizer.from_pretrained("sapientinc/HRM-Text-1B")
|
| 6 |
-
model = AutoModelForCausalLM.from_pretrained("sapientinc/HRM-Text-1B")
|
| 7 |
|
| 8 |
def chat(message, history):
|
| 9 |
-
|
| 10 |
-
return result[0]["generated_text"]
|
| 11 |
|
| 12 |
gr.ChatInterface(fn=chat).launch()
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "transformers", "torch", "gradio"])
|
| 5 |
+
|
| 6 |
import gradio as gr
|
| 7 |
+
from transformers import pipeline
|
| 8 |
|
| 9 |
pipe = pipeline("text-generation", model="sapientinc/HRM-Text-1B")
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def chat(message, history):
|
| 12 |
+
return pipe(message, max_length=200)[0]["generated_text"]
|
|
|
|
| 13 |
|
| 14 |
gr.ChatInterface(fn=chat).launch()
|