Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
import openai
|
| 2 |
import gradio as gr
|
| 3 |
import re
|
| 4 |
-
import pytesseract
|
| 5 |
-
from PIL import Image
|
| 6 |
|
| 7 |
# Set up the OpenAI API key
|
| 8 |
openai.api_key = "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 "
|
|
@@ -30,14 +28,8 @@ def classify_words(text):
|
|
| 30 |
|
| 31 |
return output_text
|
| 32 |
|
| 33 |
-
def image_to_text(file):
|
| 34 |
-
# Use Tesseract OCR to extract text from the input image
|
| 35 |
-
text = pytesseract.image_to_string(Image.open(file.name))
|
| 36 |
-
return text
|
| 37 |
-
|
| 38 |
# Set up the Gradio interface
|
| 39 |
input_text = gr.inputs.Textbox(label="Enter a paragraph of text with hard English words")
|
| 40 |
-
input_image = gr.inputs.Image(label="Upload an image containing text")
|
| 41 |
output_text = gr.outputs.Textbox(label="Simple English meanings of identified hard English words")
|
| 42 |
|
| 43 |
-
gr.Interface(classify_words, inputs=
|
|
|
|
| 1 |
import openai
|
| 2 |
import gradio as gr
|
| 3 |
import re
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Set up the OpenAI API key
|
| 6 |
openai.api_key = "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 "
|
|
|
|
| 28 |
|
| 29 |
return output_text
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Set up the Gradio interface
|
| 32 |
input_text = gr.inputs.Textbox(label="Enter a paragraph of text with hard English words")
|
|
|
|
| 33 |
output_text = gr.outputs.Textbox(label="Simple English meanings of identified hard English words")
|
| 34 |
|
| 35 |
+
gr.Interface(classify_words, inputs=input_text, outputs=output_text, title="Hard English Word Classifier", description="Enter a paragraph of text with hard English words to identify and provide their simple English meanings.").launch()
|