Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +43 -0
- requirements.txt +0 -0
app.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import stylecloud
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import os
|
| 5 |
+
#fonksiyon tanımla
|
| 6 |
+
def create_stylecloud(file,language,icon):
|
| 7 |
+
#icon kodları için :https://fontawesome.com/icons
|
| 8 |
+
text=file.decode("utf-8")
|
| 9 |
+
output_file='stylecloud.png'
|
| 10 |
+
|
| 11 |
+
#kelime bulutu oluştur
|
| 12 |
+
stylecloud.gen_stylecloud(
|
| 13 |
+
text=text,
|
| 14 |
+
icon_name=icon,
|
| 15 |
+
size=500,
|
| 16 |
+
output_name=output_file,
|
| 17 |
+
)
|
| 18 |
+
#oluşturlan kelime bulutunun dosya adı
|
| 19 |
+
return output_file
|
| 20 |
+
'''
|
| 21 |
+
Extra paretmetreler
|
| 22 |
+
palette="cartocolors.qualitative.Bold_10",
|
| 23 |
+
gradient="horizontal",
|
| 24 |
+
background_color="white",
|
| 25 |
+
collocations=False
|
| 26 |
+
'''
|
| 27 |
+
#Gradio arayüzünü oluştur
|
| 28 |
+
with gr.Blocks() as demo:
|
| 29 |
+
gr.Markdown('Kelime Bulutu Oluşturucu')
|
| 30 |
+
with gr.Row():
|
| 31 |
+
file_input=gr.File(label='Metin dosyasını yükle', type='binary')
|
| 32 |
+
language=gr.Radio(choices=['TR', 'En'],label='Dil Seçimi', value='TR')
|
| 33 |
+
icon=gr.Dropdown(choices=["fas fa-car", "fas fa-star-and-crescent", "fas fa-trophy", "fas fa-heart"],
|
| 34 |
+
label='İkon seçimi',value="fas fa-car")
|
| 35 |
+
output_file=gr.File(label='Kelime Bulutunu indir')
|
| 36 |
+
create_button=gr.Button('Oluştur')
|
| 37 |
+
#butona basıldığında
|
| 38 |
+
create_button.click(
|
| 39 |
+
create_stylecloud,
|
| 40 |
+
inputs=[file_input,language,icon],
|
| 41 |
+
outputs=output_file
|
| 42 |
+
)
|
| 43 |
+
demo.launch(share=True) #share=True public lnk verir
|
requirements.txt
ADDED
|
Binary file (82 Bytes). View file
|
|
|