Spaces:
Running
Running
fix parsing, add ContentType to Cloudflare video upload
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
from document_to_gloss import DocumentToASLConverter
|
|
|
2 |
from vectorizer import Vectorizer
|
3 |
from video_gen import create_multi_stitched_video
|
4 |
import gradio as gr
|
@@ -41,6 +42,7 @@ outputs = [
|
|
41 |
gr.HTML(label="Download Link")
|
42 |
]
|
43 |
|
|
|
44 |
asl_converter = DocumentToASLConverter()
|
45 |
vectorizer = Vectorizer()
|
46 |
session = boto3.session.Session()
|
@@ -278,6 +280,7 @@ def predict_unified(input_data):
|
|
278 |
"message": "Please provide text or upload a document"
|
279 |
}, None
|
280 |
|
|
|
281 |
# Use the unified processing function
|
282 |
result = parse_vectorize_and_search_unified_sync(input_data)
|
283 |
|
@@ -319,28 +322,9 @@ def predict_unified(input_data):
|
|
319 |
def create_interface():
|
320 |
"""Create and configure the Gradio interface"""
|
321 |
|
322 |
-
def process_inputs(text, file):
|
323 |
-
"""Process text or file input and return results"""
|
324 |
-
# Determine which input to use
|
325 |
-
if text and text.strip():
|
326 |
-
# Use text input
|
327 |
-
input_data = text.strip()
|
328 |
-
elif file is not None:
|
329 |
-
# Use file input
|
330 |
-
input_data = file
|
331 |
-
else:
|
332 |
-
# No input provided
|
333 |
-
return {
|
334 |
-
"status": "error",
|
335 |
-
"message": "Please provide either text or upload a file"
|
336 |
-
}, None
|
337 |
-
|
338 |
-
# Process using the unified function
|
339 |
-
return predict_unified(input_data)
|
340 |
-
|
341 |
# Create the interface
|
342 |
interface = gr.Interface(
|
343 |
-
fn=
|
344 |
inputs=[
|
345 |
gr.Textbox(
|
346 |
label="Enter text to convert to ASL",
|
@@ -376,7 +360,7 @@ def predict(text, file):
|
|
376 |
input_data = text.strip()
|
377 |
elif file is not None:
|
378 |
# Use file input
|
379 |
-
input_data = file
|
380 |
else:
|
381 |
# No input provided
|
382 |
return {
|
|
|
1 |
from document_to_gloss import DocumentToASLConverter
|
2 |
+
from document_parsing import DocumentParser
|
3 |
from vectorizer import Vectorizer
|
4 |
from video_gen import create_multi_stitched_video
|
5 |
import gradio as gr
|
|
|
42 |
gr.HTML(label="Download Link")
|
43 |
]
|
44 |
|
45 |
+
parser = DocumentParser()
|
46 |
asl_converter = DocumentToASLConverter()
|
47 |
vectorizer = Vectorizer()
|
48 |
session = boto3.session.Session()
|
|
|
280 |
"message": "Please provide text or upload a document"
|
281 |
}, None
|
282 |
|
283 |
+
print("Input", input_data)
|
284 |
# Use the unified processing function
|
285 |
result = parse_vectorize_and_search_unified_sync(input_data)
|
286 |
|
|
|
322 |
def create_interface():
|
323 |
"""Create and configure the Gradio interface"""
|
324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
# Create the interface
|
326 |
interface = gr.Interface(
|
327 |
+
fn=predict,
|
328 |
inputs=[
|
329 |
gr.Textbox(
|
330 |
label="Enter text to convert to ASL",
|
|
|
360 |
input_data = text.strip()
|
361 |
elif file is not None:
|
362 |
# Use file input
|
363 |
+
input_data = parser.extract_text(file)
|
364 |
else:
|
365 |
# No input provided
|
366 |
return {
|