Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,9 @@ def process_youtube_url(url, language):
|
|
| 17 |
text_splitter = TokenTextSplitter(chunk_size=10000, chunk_overlap=0)
|
| 18 |
chunks = text_splitter.split_text(text)
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
return output_textboxes, [], "", char_count
|
| 23 |
except Exception as e:
|
|
@@ -54,7 +56,7 @@ iface = gr.Interface(
|
|
| 54 |
gr.Dropdown(label="Language",value="ja",choices=["en","en-US", "ja", "fr","de","it"],allow_custom_value=True),
|
| 55 |
],
|
| 56 |
outputs=[
|
| 57 |
-
gr.Column(output_textboxes),
|
| 58 |
gr.Dropdown(label="Available Languages", allow_custom_value=True),
|
| 59 |
gr.Textbox(label="Recommended Language"),
|
| 60 |
gr.Number(label="Character Count")
|
|
|
|
| 17 |
text_splitter = TokenTextSplitter(chunk_size=10000, chunk_overlap=0)
|
| 18 |
chunks = text_splitter.split_text(text)
|
| 19 |
|
| 20 |
+
max_textboxes = 10
|
| 21 |
+
output_textboxes = [gr.Textbox(label=f"Chunk {i+1}", value=chunk, show_copy_button=True, visible=i < len(chunks)) for i, chunk in enumerate(chunks[:max_textboxes])]
|
| 22 |
+
output_textboxes += [gr.Textbox(visible=False) for _ in range(max_textboxes - len(chunks))]
|
| 23 |
|
| 24 |
return output_textboxes, [], "", char_count
|
| 25 |
except Exception as e:
|
|
|
|
| 56 |
gr.Dropdown(label="Language",value="ja",choices=["en","en-US", "ja", "fr","de","it"],allow_custom_value=True),
|
| 57 |
],
|
| 58 |
outputs=[
|
| 59 |
+
gr.Column(lambda x: x, output_textboxes),
|
| 60 |
gr.Dropdown(label="Available Languages", allow_custom_value=True),
|
| 61 |
gr.Textbox(label="Recommended Language"),
|
| 62 |
gr.Number(label="Character Count")
|