Spaces:
Runtime error
Runtime error
small improvements
Browse files
app.py
CHANGED
@@ -13,12 +13,14 @@ def check_password(username, password):
|
|
13 |
def func(file, number_of_pages, secret):
|
14 |
if secret != os.environ["ACCESS"]:
|
15 |
return "Wrong password, please try again"
|
16 |
-
|
|
|
|
|
17 |
# generate a random sequence of numbers
|
18 |
# s = "".join([str(random.randint(0, 9)) for i in range(10)])
|
19 |
# with open(f"{s}.tex", "w", encoding="utf-8") as f:
|
20 |
# f.write(text)
|
21 |
-
return
|
22 |
|
23 |
def upload_file(file):
|
24 |
return file.name
|
@@ -63,7 +65,7 @@ if __name__ == "__main__":
|
|
63 |
|
64 |
number_of_pages = gr.Number(label="Number of pages")
|
65 |
secret = gr.Textbox(label="Password", type="password")
|
66 |
-
output = gr.Textbox(label="Output")
|
67 |
greet_btn = gr.Button("Generate slides")
|
68 |
greet_btn.click(fn=func, inputs=[upload_button, number_of_pages, secret], outputs=output, api_name="greet")
|
69 |
|
|
|
13 |
def func(file, number_of_pages, secret):
|
14 |
if secret != os.environ["ACCESS"]:
|
15 |
return "Wrong password, please try again"
|
16 |
+
output = client.predict(file, number_of_pages)
|
17 |
+
if "Error" in output:
|
18 |
+
return output
|
19 |
# generate a random sequence of numbers
|
20 |
# s = "".join([str(random.randint(0, 9)) for i in range(10)])
|
21 |
# with open(f"{s}.tex", "w", encoding="utf-8") as f:
|
22 |
# f.write(text)
|
23 |
+
return output
|
24 |
|
25 |
def upload_file(file):
|
26 |
return file.name
|
|
|
65 |
|
66 |
number_of_pages = gr.Number(label="Number of pages")
|
67 |
secret = gr.Textbox(label="Password", type="password")
|
68 |
+
output = gr.Textbox(label="Output", show_copy_button=True, interactive=False)
|
69 |
greet_btn = gr.Button("Generate slides")
|
70 |
greet_btn.click(fn=func, inputs=[upload_button, number_of_pages, secret], outputs=output, api_name="greet")
|
71 |
|