Hardik5456 commited on
Commit
1f5363d
·
verified ·
1 Parent(s): b172e08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -1,10 +1,14 @@
1
  import gradio as gr
 
2
 
3
- with gr.Blocks(fill_height=True) as demo:
4
- with gr.Sidebar():
5
- gr.Markdown("# Inference Provider")
6
- gr.Markdown("This Space showcases the agentica-org/DeepScaleR-1.5B-Preview model, served by the hf-inference API. Sign in with your Hugging Face account to use this API.")
7
- button = gr.LoginButton("Sign in")
8
- gr.load("models/agentica-org/DeepScaleR-1.5B-Preview", accept_token=button, provider="hf-inference")
9
-
10
- demo.launch()
 
 
 
 
1
  import gradio as gr
2
+ from transformers import AutoModelForCausalLM, AutoTokenizer
3
 
4
+ model_name = "agentica-org/DeepScaleR-1.5B-Preview"
5
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
6
+ model = AutoModelForCausalLM.from_pretrained(model_name)
7
+
8
+ def generate_response(prompt):
9
+ inputs = tokenizer(prompt, return_tensors="pt")
10
+ outputs = model.generate(**inputs, max_length=100)
11
+ return tokenizer.decode(outputs[0], skip_special_tokens=True)
12
+
13
+ iface = gr.Interface(fn=generate_response, inputs="text", outputs="text", title="DeepScaleR Text Generator")
14
+ iface.launch()