umarigan commited on
Commit
4b395c1
·
verified ·
1 Parent(s): 5803297

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import pipeline
3
+ import gradio as gr
4
+
5
+ # Load the model
6
+ model_id = "umarigan/deepseek-r1-reasoning-prompt-generator"
7
+ pipe = pipeline(
8
+ "text-generation",
9
+ model=model_id,
10
+ torch_dtype=torch.bfloat16,
11
+ device_map="auto",
12
+ )
13
+
14
+ def generate_prompt(query):
15
+ messages = [
16
+ {"role": "user", "content": query},
17
+ ]
18
+ outputs = pipe(
19
+ messages,
20
+ max_new_tokens=4096,
21
+ )
22
+ return outputs[0]["generated_text"][-1]['content']
23
+
24
+ # Gradio Interface
25
+ iface = gr.Interface(
26
+ fn=generate_prompt,
27
+ inputs=gr.Textbox(lines=2, placeholder="Enter your query here..."),
28
+ outputs=gr.Textbox(lines=10, placeholder="Generated reasoning prompt will appear here..."),
29
+ title="Reasoning Prompt Generator",
30
+ description="Enter a query to generate a reasoning prompt.",
31
+ )
32
+
33
+ # Launch the app
34
+ iface.launch()