Spaces:
Sleeping
Sleeping
Commit
·
8dccf26
1
Parent(s):
8bc144c
Update app.py
Browse files
app.py
CHANGED
@@ -7,9 +7,7 @@ import gradio
|
|
7 |
import json
|
8 |
from pathlib import Path
|
9 |
from bs4 import BeautifulSoup
|
10 |
-
|
11 |
-
from PIL import Image
|
12 |
-
import numpy as np
|
13 |
|
14 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
15 |
|
@@ -45,15 +43,15 @@ static_dir.mkdir(parents=True, exist_ok=True)
|
|
45 |
|
46 |
|
47 |
|
48 |
-
def CustomChatGPT(html_explainer, recipe
|
49 |
recipe_name_str=""
|
50 |
ingredients_str=""
|
51 |
steps_str=""
|
52 |
import_link_str = ""
|
53 |
|
54 |
|
55 |
-
if image is not None and bool(image):
|
56 |
-
|
57 |
|
58 |
if recipe is not None and bool(recipe):
|
59 |
messages.append({"role": "user", "content": recipe})
|
@@ -93,7 +91,6 @@ html_explainer = '''
|
|
93 |
<li>Click on Submit</li>
|
94 |
<li>If you click import after receiving the results, the recipe can be imported in a compatible format with your favorite recipe app's browser extension.</li>
|
95 |
</ol>
|
96 |
-
<p>You might be inclined to upload the image you took. You can do it! But I warn you that this functionality is not working perfectly yet, and it's resulting in funny recipes.</p>
|
97 |
'''
|
98 |
|
99 |
|
@@ -108,13 +105,13 @@ gradio_txt_output_steps = gradio.Textbox(label="Preparation Steps", lines=2, pla
|
|
108 |
|
109 |
demo = gradio.Interface(
|
110 |
fn=CustomChatGPT,
|
111 |
-
inputs=[gradio_input_html_explainer, gradio_txt_input_recipe_content
|
112 |
outputs=[gradio_txt_output_recipe_name, gradio_txt_output_ingredients,gradio_txt_output_steps,gradio.HTML()],
|
113 |
title="Recipe Cleaner",
|
114 |
allow_flagging="never"
|
115 |
)
|
116 |
|
117 |
-
|
118 |
-
demo.launch(share=True)
|
119 |
|
120 |
|
|
|
7 |
import json
|
8 |
from pathlib import Path
|
9 |
from bs4 import BeautifulSoup
|
10 |
+
|
|
|
|
|
11 |
|
12 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
13 |
|
|
|
43 |
|
44 |
|
45 |
|
46 |
+
def CustomChatGPT(html_explainer, recipe):
|
47 |
recipe_name_str=""
|
48 |
ingredients_str=""
|
49 |
steps_str=""
|
50 |
import_link_str = ""
|
51 |
|
52 |
|
53 |
+
# if image is not None and bool(image):
|
54 |
+
# recipe = pytesseract.image_to_string(Image.open(image))
|
55 |
|
56 |
if recipe is not None and bool(recipe):
|
57 |
messages.append({"role": "user", "content": recipe})
|
|
|
91 |
<li>Click on Submit</li>
|
92 |
<li>If you click import after receiving the results, the recipe can be imported in a compatible format with your favorite recipe app's browser extension.</li>
|
93 |
</ol>
|
|
|
94 |
'''
|
95 |
|
96 |
|
|
|
105 |
|
106 |
demo = gradio.Interface(
|
107 |
fn=CustomChatGPT,
|
108 |
+
inputs=[gradio_input_html_explainer, gradio_txt_input_recipe_content],
|
109 |
outputs=[gradio_txt_output_recipe_name, gradio_txt_output_ingredients,gradio_txt_output_steps,gradio.HTML()],
|
110 |
title="Recipe Cleaner",
|
111 |
allow_flagging="never"
|
112 |
)
|
113 |
|
114 |
+
demo.launch()
|
115 |
+
# demo.launch(share=True)
|
116 |
|
117 |
|