File size: 379 Bytes
9bb9594 5a96fee 9bb9594 310141c b90cb7a 5a96fee 9bb9594 10b4484 6233f5b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import subprocess
import sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "transformers", "torch", "gradio"])
import gradio as gr
from transformers import pipeline
pipe = pipeline("text-generation", model="sapientinc/HRM-Text-1B")
def chat(message, history):
return pipe(message, max_length=200)[0]["generated_text"]
gr.ChatInterface(fn=chat).launch()
|