Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,10 +36,10 @@ def query(payload):
|
|
36 |
print(payload)
|
37 |
response = requests.request("POST", API_URL, json=payload)
|
38 |
print(response)
|
39 |
-
return
|
40 |
|
41 |
def inference(input_sentence, max_length, sample_or_greedy, raw_text=False):
|
42 |
-
payload = {"
|
43 |
|
44 |
data = query(
|
45 |
payload
|
@@ -64,7 +64,7 @@ def inference(input_sentence, max_length, sample_or_greedy, raw_text=False):
|
|
64 |
BOX_COMP: "#120F25",
|
65 |
}
|
66 |
|
67 |
-
new_string = data[
|
68 |
|
69 |
_, img = main(
|
70 |
input_sentence,
|
@@ -79,7 +79,7 @@ def inference(input_sentence, max_length, sample_or_greedy, raw_text=False):
|
|
79 |
init_font_size=150,
|
80 |
right_align=False,
|
81 |
)
|
82 |
-
return img, data[
|
83 |
|
84 |
|
85 |
gr.Interface(
|
|
|
36 |
print(payload)
|
37 |
response = requests.request("POST", API_URL, json=payload)
|
38 |
print(response)
|
39 |
+
return response.json()
|
40 |
|
41 |
def inference(input_sentence, max_length, sample_or_greedy, raw_text=False):
|
42 |
+
payload = {"prompt": input_sentence, "gen_method": sample_or_greedy, "max_new_tokens": max_length}
|
43 |
|
44 |
data = query(
|
45 |
payload
|
|
|
64 |
BOX_COMP: "#120F25",
|
65 |
}
|
66 |
|
67 |
+
new_string = data['generated_text'][0].split(input_sentence, 1)[1]
|
68 |
|
69 |
_, img = main(
|
70 |
input_sentence,
|
|
|
79 |
init_font_size=150,
|
80 |
right_align=False,
|
81 |
)
|
82 |
+
return img, data['generated_text'][0]
|
83 |
|
84 |
|
85 |
gr.Interface(
|