Spaces:
Build error

ojoke commited on
Commit
50801a2
·
verified ·
1 Parent(s): fd4dc4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -6
app.py CHANGED
@@ -1,10 +1,31 @@
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 Qwen/Qwen3-0.6B model, served by the novita API. Sign in with your Hugging Face account to use this API.")
7
- button = gr.LoginButton("Sign in")
8
- gr.load("models/Qwen/Qwen3-0.6B", accept_token=button, provider="novita")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
 
 
10
  demo.launch()
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
+ import torch
4
 
5
+ pipe = pipeline("text-generation", model="google/gemma-3-1b-it", torch_dtype=torch.bfloat16)
6
+
7
+ messages = [
8
+ [
9
+ {
10
+ "role": "system",
11
+ "content": [{"type": "text", "text": "You are a helpful assistant."}],
12
+ },
13
+ {
14
+ "role": "user",
15
+ "content": [{"type": "text", "text": "Tell me some of the most important part in a motorcycle"}],
16
+ },
17
+ ],
18
+ ]
19
+
20
+ def predict():
21
+ output = pipe(messages, max_new_tokens=500)
22
+ return str(output)
23
+
24
+ with gr.Blocks() as demo:
25
+ gr.Markdown("# AI Output")
26
+ output_box = gr.Textbox(label="Generated Output", lines=10)
27
+ generate_btn = gr.Button("Generate")
28
 
29
+ generate_btn.click(fn=predict, outputs=output_box)
30
+
31
  demo.launch()