datamining-final / hello_gradio.py
nelson40514's picture
Upload folder using huggingface_hub
d737845 verified
raw
history blame contribute delete
No virus
1.88 kB
import gradio as gr
from gradioWordCloud import wordCloud
from gradioTimeSeries import timeSeries
from gradioSankey import sankey
with gr.Blocks() as demo:
with gr.Tab("文字雲"):
gr.Markdown(
"## 文字雲\n"
"### 輸入資料\n"
"1. 請輸入來源資料網址(ex: `https://168.motc.gov.tw/opendata/csv/news` ),程式會自動下載新聞資料\n"
"2. 資料會經過處理,並產生文字雲\n"
"3. 請注意,文字雲會顯示出現頻率較高的字詞\n"
)
wordCloud_interface = gr.Interface(
fn=wordCloud,
# title="文字雲",
inputs="text",
outputs="image"
)
with gr.Tab("時間序列圖"):
gr.Markdown(
"## 時間序列圖\n"
"### 輸入資料\n"
"1. 系統會自動到高速公路資料網站進行爬取資料(目前以'五股~高公局~林口(文化一路)'為例)\n"
"2. 請以slider輸入開始與結束的日期( 目前已高公局五月初的資料進行研究 ),程式會自動下載資料\n"
"3. 資料會經過處理,並產生時間序列圖\n"
)
timeSeries_interface = gr.Interface(
fn=timeSeries,
title="時間序列圖",
inputs=[
gr.Slider(value=6, minimum=6, maximum=12, step=1),
gr.Slider(value=7, minimum=6, maximum=12, step=1)
],
outputs="plot"
)
with gr.Tab("Sankey Diagram"):
hello_interface = gr.Interface(
fn=sankey,
inputs=gr.Markdown(
"## Sankey Diagram\n"
"### 不須輸入資料\n"
"系統以範例資料進行繪製\n"
),
outputs="image"
)
# demo.launch()
demo.launch(share=True)