Spaces:
Sleeping
Sleeping
fixes
Browse files
app.py
CHANGED
@@ -7,13 +7,13 @@ 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
|
11 |
|
12 |
-
print(f"*****Inside
|
13 |
-
print(f"length of
|
14 |
print(f"length of prompt is {len(prompt)}")
|
15 |
if len(prompt) == 0:
|
16 |
-
prompt =
|
17 |
|
18 |
json_ = {"inputs": prompt,
|
19 |
"parameters":
|
@@ -58,13 +58,13 @@ with demo:
|
|
58 |
example_prompt = gr.Radio( ["Once upon a time in a land far away"], label= "Choose a sample Prompt")
|
59 |
|
60 |
#with gr.Column:
|
61 |
-
|
62 |
|
63 |
with gr.Row():
|
64 |
generated_txt = gr.Textbox(lines=3)
|
65 |
|
66 |
b1 = gr.Button("Generate Text")
|
67 |
-
b1.click(
|
68 |
|
69 |
with gr.Row():
|
70 |
gr.Markdown("")
|
|
|
7 |
HF_TOKEN = os.environ["HF_TOKEN"]
|
8 |
headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
9 |
|
10 |
+
def text_generate(prompt, input_prompt):
|
11 |
|
12 |
+
print(f"*****Inside TEXT_generate - Prompt is :{prompt}")
|
13 |
+
print(f"length of input_prompt is {len(input_prompt)}")
|
14 |
print(f"length of prompt is {len(prompt)}")
|
15 |
if len(prompt) == 0:
|
16 |
+
prompt = input_prompt
|
17 |
|
18 |
json_ = {"inputs": prompt,
|
19 |
"parameters":
|
|
|
58 |
example_prompt = gr.Radio( ["Once upon a time in a land far away"], label= "Choose a sample Prompt")
|
59 |
|
60 |
#with gr.Column:
|
61 |
+
input_prompt = gr.Textbox(label="Write text to prompt the model", value="Once upon a time in a land far away", lines=6)
|
62 |
|
63 |
with gr.Row():
|
64 |
generated_txt = gr.Textbox(lines=3)
|
65 |
|
66 |
b1 = gr.Button("Generate Text")
|
67 |
+
b1.click(text_generate,inputs=[example_prompt, input_prompt], outputs=generated_txt)
|
68 |
|
69 |
with gr.Row():
|
70 |
gr.Markdown("")
|