abdulmeLINK commited on
Commit
5e436e0
·
1 Parent(s): fbe1c0d
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  import os
2
  import requests
3
  import gradio as gr
@@ -42,13 +45,13 @@ def post(jsn):
42
 
43
 
44
  def get_script(lang, instruction):
45
- jsn = {"inputs": comment_syntaxes[lang].format("Instruction: " + instruction.replace(
46
- '\n', '')) + '\n' + comment_syntaxes[lang].format("Code:") + '\n', **jsn_trail}
47
  return post(jsn)
48
 
49
 
50
  def feedback(opt):
51
- return post({"inputs": opt}, **jsn_trail)
52
 
53
 
54
  demo = gr.Blocks()
@@ -60,20 +63,20 @@ with demo:
60
  "<p>This project aims to prepare a prompt for BLOOM to generate scripts</p>")
61
  with gr.Row():
62
 
63
- dropdown = gr.Dropdown(
64
- choices=list(comment_syntaxes.keys()), label="Choose the language")
65
 
66
  # with gr.Column:
67
  instruction = gr.Textbox(label="Write an instruction",
68
  value="Create a python function that generates random password with given length using ascii characters ", lines=6)
69
 
70
  with gr.Row():
71
- generated_txt = gr.Textbox(lines=5)
72
 
73
  btn = gr.Button("Generate")
74
  btn.click(get_script, inputs=[dropdown,
75
  instruction], outputs=generated_txt)
76
- feeedback_btn = gr.Button("Feed the Output back")
77
  feeedback_btn.click(
78
  feedback, inputs=[generated_txt], outputs=generated_txt)
79
  with gr.Row():
 
1
+ from cProfile import label
2
+ from code import interact
3
+ from multiprocessing.util import ForkAwareThreadLock
4
  import os
5
  import requests
6
  import gradio as gr
 
45
 
46
 
47
  def get_script(lang, instruction):
48
+ jsn = {"inputs": "Programming Language: " + lang + "\n" + comment_syntaxes[lang].format("Instruction: " + instruction.replace(
49
+ '\n', '')) + '\n' + comment_syntaxes[lang].format("code below :") + '\n', **jsn_trail}
50
  return post(jsn)
51
 
52
 
53
  def feedback(opt):
54
+ return post({"inputs": opt, **jsn_trail})
55
 
56
 
57
  demo = gr.Blocks()
 
63
  "<p>This project aims to prepare a prompt for BLOOM to generate scripts</p>")
64
  with gr.Row():
65
 
66
+ dropdown = gr.Dropdown(value="Python",
67
+ choices=list(comment_syntaxes.keys()), label="Choose the language")
68
 
69
  # with gr.Column:
70
  instruction = gr.Textbox(label="Write an instruction",
71
  value="Create a python function that generates random password with given length using ascii characters ", lines=6)
72
 
73
  with gr.Row():
74
+ generated_txt = gr.Textbox(lines=5, interactive=False, label="Output")
75
 
76
  btn = gr.Button("Generate")
77
  btn.click(get_script, inputs=[dropdown,
78
  instruction], outputs=generated_txt)
79
+ feeedback_btn = gr.Button("Feedback")
80
  feeedback_btn.click(
81
  feedback, inputs=[generated_txt], outputs=generated_txt)
82
  with gr.Row():