Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ YOUTUBE_API_KEY = "YOUR_YOUTUBE_API_KEY"
|
|
15 |
|
16 |
def create_client(model_name):
|
17 |
token = os.getenv("HF_TOKEN")
|
18 |
-
return InferenceClient(
|
19 |
|
20 |
client = create_client("CohereForAI/c4ai-command-r-plus")
|
21 |
|
@@ -135,7 +135,7 @@ def analyze_titles(video_stats_df, n_clusters=5):
|
|
135 |
|
136 |
def summarize_cluster(cluster_text, cluster_num):
|
137 |
response = client(inputs=cluster_text)
|
138 |
-
summary = response['generated_text'].strip()
|
139 |
return summary
|
140 |
|
141 |
def main(query, max_results, period, page, n_clusters=5):
|
@@ -166,10 +166,10 @@ iface = gr.Interface(
|
|
166 |
fn=main,
|
167 |
inputs=[
|
168 |
gr.components.Textbox(label="검색 쿼리"),
|
169 |
-
gr.components.
|
170 |
gr.components.Dropdown(["1주일", "1개월", "3개월"], label="기간"),
|
171 |
gr.components.Dropdown(["Video Ranking", "Title Analysis"], label="페이지"),
|
172 |
-
gr.components.
|
173 |
],
|
174 |
outputs=[
|
175 |
gr.components.Dataframe(label="결과"),
|
|
|
15 |
|
16 |
def create_client(model_name):
|
17 |
token = os.getenv("HF_TOKEN")
|
18 |
+
return InferenceClient(model=model_name, token=token)
|
19 |
|
20 |
client = create_client("CohereForAI/c4ai-command-r-plus")
|
21 |
|
|
|
135 |
|
136 |
def summarize_cluster(cluster_text, cluster_num):
|
137 |
response = client(inputs=cluster_text)
|
138 |
+
summary = response[0]['generated_text'].strip()
|
139 |
return summary
|
140 |
|
141 |
def main(query, max_results, period, page, n_clusters=5):
|
|
|
166 |
fn=main,
|
167 |
inputs=[
|
168 |
gr.components.Textbox(label="검색 쿼리"),
|
169 |
+
gr.components.Textbox(label="최대 결과 수", type="number"),
|
170 |
gr.components.Dropdown(["1주일", "1개월", "3개월"], label="기간"),
|
171 |
gr.components.Dropdown(["Video Ranking", "Title Analysis"], label="페이지"),
|
172 |
+
gr.components.Textbox(label="클러스터 수", type="number")
|
173 |
],
|
174 |
outputs=[
|
175 |
gr.components.Dataframe(label="결과"),
|