Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,12 +34,12 @@ print(PIL.__version__)
|
|
| 34 |
|
| 35 |
# İkon etiketlerini ve değerlerini eşlemek için bir sözlük oluşturun
|
| 36 |
icon_map = {
|
| 37 |
-
"
|
| 38 |
-
"
|
| 39 |
-
"
|
| 40 |
-
"
|
| 41 |
-
"
|
| 42 |
-
"
|
| 43 |
}
|
| 44 |
|
| 45 |
def create_stylecloud(file, text_input, language, icon_label):
|
|
@@ -67,26 +67,26 @@ def create_stylecloud(file, text_input, language, icon_label):
|
|
| 67 |
return image
|
| 68 |
|
| 69 |
with gr.Blocks() as demo:
|
| 70 |
-
gr.Markdown('
|
| 71 |
|
| 72 |
with gr.Row():
|
| 73 |
-
input_choice = gr.Radio(choices=['
|
| 74 |
|
| 75 |
with gr.Row(visible=True) as file_input_row:
|
| 76 |
-
file_input = gr.File(label='
|
| 77 |
|
| 78 |
with gr.Row(visible=False) as text_input_row:
|
| 79 |
-
text_input = gr.Textbox(label='
|
| 80 |
|
| 81 |
with gr.Row():
|
| 82 |
-
language = gr.Radio(choices=['TR', 'EN'], label='
|
| 83 |
|
| 84 |
with gr.Row():
|
| 85 |
-
icon = gr.Dropdown(choices=list(icon_map.keys()), label='
|
| 86 |
|
| 87 |
with gr.Row():
|
| 88 |
-
create_button = gr.Button('
|
| 89 |
-
output_image = gr.Image(label='
|
| 90 |
|
| 91 |
# butona basıldığında
|
| 92 |
create_button.click(
|
|
@@ -96,7 +96,7 @@ with gr.Blocks() as demo:
|
|
| 96 |
)
|
| 97 |
|
| 98 |
def update_input_visibility(choice):
|
| 99 |
-
if choice == '
|
| 100 |
return gr.update(visible=True), gr.update(visible=False)
|
| 101 |
else:
|
| 102 |
return gr.update(visible=False), gr.update(visible=True)
|
|
|
|
| 34 |
|
| 35 |
# İkon etiketlerini ve değerlerini eşlemek için bir sözlük oluşturun
|
| 36 |
icon_map = {
|
| 37 |
+
"Car": "fas fa-car",
|
| 38 |
+
"Crescent and Star": "fas fa-star-and-crescent",
|
| 39 |
+
"Trophy": "fas fa-trophy",
|
| 40 |
+
"Heart": "fas fa-heart",
|
| 41 |
+
"Cloud": "fas fa-cloud",
|
| 42 |
+
"Gift": "fas fa-gift"
|
| 43 |
}
|
| 44 |
|
| 45 |
def create_stylecloud(file, text_input, language, icon_label):
|
|
|
|
| 67 |
return image
|
| 68 |
|
| 69 |
with gr.Blocks() as demo:
|
| 70 |
+
gr.Markdown('Word Cloud Generater')
|
| 71 |
|
| 72 |
with gr.Row():
|
| 73 |
+
input_choice = gr.Radio(choices=['Upload Your File', 'Enter Your Text'], label='Select Text Upload Format', value='Upload Your File')
|
| 74 |
|
| 75 |
with gr.Row(visible=True) as file_input_row:
|
| 76 |
+
file_input = gr.File(label='Upload Text File', type='binary')
|
| 77 |
|
| 78 |
with gr.Row(visible=False) as text_input_row:
|
| 79 |
+
text_input = gr.Textbox(label='Enter Your Text')
|
| 80 |
|
| 81 |
with gr.Row():
|
| 82 |
+
language = gr.Radio(choices=['TR', 'EN'], label='Language', value='TR')
|
| 83 |
|
| 84 |
with gr.Row():
|
| 85 |
+
icon = gr.Dropdown(choices=list(icon_map.keys()), label='Icon Selection', value='Crescent and Star')
|
| 86 |
|
| 87 |
with gr.Row():
|
| 88 |
+
create_button = gr.Button('Generate')
|
| 89 |
+
output_image = gr.Image(label='Word Cloud')
|
| 90 |
|
| 91 |
# butona basıldığında
|
| 92 |
create_button.click(
|
|
|
|
| 96 |
)
|
| 97 |
|
| 98 |
def update_input_visibility(choice):
|
| 99 |
+
if choice == 'Upload Your File':
|
| 100 |
return gr.update(visible=True), gr.update(visible=False)
|
| 101 |
else:
|
| 102 |
return gr.update(visible=False), gr.update(visible=True)
|