File size: 566 Bytes
36a6d58
 
 
 
 
b0274dd
 
 
 
 
 
 
 
 
 
 
 
 
36a6d58
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr

def greet(name):
    return "Hello " + name + "!!"

# Use a pipeline as a high-level helper
from transformers import pipeline

messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe = pipeline("text-generation", model="cyan2k/molmo-7B-D-bnb-4bit", trust_remote_code=True)
pipe(messages)

# Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("cyan2k/molmo-7B-D-bnb-4bit", trust_remote_code=True)

demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()