schoginitoys commited on
Commit
acff9e8
·
1 Parent(s): cbe0187
Files changed (2) hide show
  1. app.py +22 -0
  2. push.sh +7 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load a GPT-Neo model fine-tuned for code generation
5
+ generator = pipeline('text-generation', model='EleutherAI/gpt-neo-2.7B')
6
+
7
+ def generate_code(prompt):
8
+ # Generate code from the model
9
+ responses = generator(prompt, max_length=50, num_return_sequences=1, temperature=0.5)
10
+ return responses[0]['generated_text']
11
+
12
+ # Create a Gradio Interface
13
+ iface = gr.Interface(
14
+ fn=generate_code,
15
+ inputs=[gr.inputs.Textbox(lines=10, label="Type your code description here")],
16
+ outputs=[gr.outputs.Textbox(label="Generated Code")],
17
+ examples=[["Create a Python function to add two numbers"]],
18
+ )
19
+
20
+ # Run the interface
21
+ if __name__ == "__main__":
22
+ iface.launch()
push.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+
2
+
3
+ git add .
4
+ git commit -m Sree
5
+ git push
6
+
7
+ echo visit https://schogini-test1.hf.space