Update app.py
Browse files
app.py
CHANGED
|
@@ -3,5 +3,18 @@ import gradio as gr
|
|
| 3 |
def greet(name):
|
| 4 |
return "Hello " + name + "!!"
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
demo.launch()
|
|
|
|
| 3 |
def greet(name):
|
| 4 |
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
+
# Use a pipeline as a high-level helper
|
| 7 |
+
from transformers import pipeline
|
| 8 |
+
|
| 9 |
+
messages = [
|
| 10 |
+
{"role": "user", "content": "Who are you?"},
|
| 11 |
+
]
|
| 12 |
+
pipe = pipeline("text-generation", model="cyan2k/molmo-7B-D-bnb-4bit", trust_remote_code=True)
|
| 13 |
+
pipe(messages)
|
| 14 |
+
|
| 15 |
+
# Load model directly
|
| 16 |
+
from transformers import AutoModelForCausalLM
|
| 17 |
+
model = AutoModelForCausalLM.from_pretrained("cyan2k/molmo-7B-D-bnb-4bit", trust_remote_code=True)
|
| 18 |
+
|
| 19 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 20 |
demo.launch()
|