Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import spaces | |
| import torch | |
| import transformers | |
| import torch | |
| model_id = "meta-llama/Meta-Llama-3-8B" | |
| pipeline = transformers.pipeline( | |
| "text-generation", model=model_id, model_kwargs={"torch_dtype": torch.bfloat16}, device_map="auto" | |
| ) | |
| def yes_man(message, history): | |
| return pipeline(message) | |
| gr.ChatInterface( | |
| yes_man, | |
| chatbot=gr.Chatbot(height=300), | |
| textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=7), | |
| title="Yes Man", | |
| description="Ask Yes Man any question", | |
| theme="soft", | |
| examples=["Hello", "Am I cool?", "Are tomatoes vegetables?"], | |
| cache_examples=True, | |
| retry_btn=None, | |
| undo_btn="Delete Previous", | |
| clear_btn="Clear", | |
| ).launch() |