Spaces:
Runtime error
Runtime error
update
Browse files
app.py
CHANGED
@@ -7,14 +7,6 @@ API_URL = "https://api-inference.huggingface.co/models/bigscience/bloom"
|
|
7 |
HF_TOKEN = os.environ["HF_TOKEN"]
|
8 |
headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
9 |
|
10 |
-
#def query(payload):
|
11 |
-
# response = requests.post(API_URL, headers=headers, json=payload)
|
12 |
-
# return response.json()
|
13 |
-
|
14 |
-
#output = query({
|
15 |
-
# "inputs": "Can you please let us know more details about your ",
|
16 |
-
#})
|
17 |
-
|
18 |
|
19 |
prompt1 = """
|
20 |
word: risk
|
@@ -40,9 +32,11 @@ A: Let’s think step by step.
|
|
40 |
|
41 |
|
42 |
|
43 |
-
def text_generate(prompt):
|
44 |
|
45 |
print(f"*****Inside poem_generate - Prompt is :{prompt}")
|
|
|
|
|
46 |
json_ = {"inputs": prompt,
|
47 |
"parameters":
|
48 |
{
|
@@ -87,7 +81,8 @@ with demo:
|
|
87 |
with gr.Row():
|
88 |
#example_prompt = gr.Radio( ["Q: A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there?\nA: Let’s think step by step.\n"], label= "Choose a sample Prompt")
|
89 |
example_prompt = gr.Radio( ["Instruction: Given an input question, respond with syntactically correct PostgreSQL\nInput: how many users signed up in the past month?\nPostgreSQL query: "], label= "Choose a sample Prompt")
|
90 |
-
|
|
|
91 |
#input_word = gr.Textbox(placeholder="Enter a word here to generate text ...")
|
92 |
generated_txt = gr.Textbox(lines=7)
|
93 |
#output_image = gr.Image(type="filepath", shape=(256,256))
|
@@ -95,7 +90,7 @@ with demo:
|
|
95 |
b1 = gr.Button("Generate SQL")
|
96 |
#b2 = gr.Button("Generate Image")
|
97 |
|
98 |
-
b1.click(text_generate,inputs=example_prompt, outputs=generated_txt) #input_word
|
99 |
#b2.click(poem_to_image, poem_txt, output_image)
|
100 |
#examples=examples
|
101 |
|
|
|
7 |
HF_TOKEN = os.environ["HF_TOKEN"]
|
8 |
headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
prompt1 = """
|
12 |
word: risk
|
|
|
32 |
|
33 |
|
34 |
|
35 |
+
def text_generate(prompt, input_prompt):
|
36 |
|
37 |
print(f"*****Inside poem_generate - Prompt is :{prompt}")
|
38 |
+
if input_prompt != '':
|
39 |
+
prompt = input_prompt
|
40 |
json_ = {"inputs": prompt,
|
41 |
"parameters":
|
42 |
{
|
|
|
81 |
with gr.Row():
|
82 |
#example_prompt = gr.Radio( ["Q: A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there?\nA: Let’s think step by step.\n"], label= "Choose a sample Prompt")
|
83 |
example_prompt = gr.Radio( ["Instruction: Given an input question, respond with syntactically correct PostgreSQL\nInput: how many users signed up in the past month?\nPostgreSQL query: "], label= "Choose a sample Prompt")
|
84 |
+
input_prompt = gr.Textbox(label="Or Write text to get SQL commands...")
|
85 |
+
|
86 |
#input_word = gr.Textbox(placeholder="Enter a word here to generate text ...")
|
87 |
generated_txt = gr.Textbox(lines=7)
|
88 |
#output_image = gr.Image(type="filepath", shape=(256,256))
|
|
|
90 |
b1 = gr.Button("Generate SQL")
|
91 |
#b2 = gr.Button("Generate Image")
|
92 |
|
93 |
+
b1.click(text_generate,inputs=[example_prompt, input_prompt], outputs=generated_txt) #input_word
|
94 |
#b2.click(poem_to_image, poem_txt, output_image)
|
95 |
#examples=examples
|
96 |
|