Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -125,20 +125,22 @@ def do_web_search(query: str) -> str:
|
|
| 125 |
summary_lines.append(
|
| 126 |
f"### Result {idx}: {title}\n\n"
|
| 127 |
f"{snippet}\n\n"
|
| 128 |
-
f"
|
| 129 |
f"---\n"
|
| 130 |
)
|
| 131 |
|
| 132 |
# ๋ชจ๋ธ์๊ฒ ๋ช
ํํ ์ง์นจ ์ถ๊ฐ
|
| 133 |
instructions = """
|
| 134 |
-
#
|
| 135 |
-
|
| 136 |
-
1.
|
| 137 |
-
2.
|
|
|
|
|
|
|
| 138 |
"""
|
| 139 |
|
| 140 |
search_results = instructions + "\n".join(summary_lines)
|
| 141 |
-
logger.info(f"
|
| 142 |
return search_results
|
| 143 |
|
| 144 |
except Exception as e:
|
|
@@ -498,12 +500,13 @@ def run(
|
|
| 498 |
ws_result = do_web_search(ws_query)
|
| 499 |
combined_system_msg += f"[Search top-20 Full Items Based on user prompt]\n{ws_result}\n\n"
|
| 500 |
# >>> ์ถ๊ฐ๋ ์๋ด ๋ฌธ๊ตฌ (๊ฒ์ ๊ฒฐ๊ณผ์ link ๋ฑ ์ถ์ฒ๋ฅผ ํ์ฉ)
|
| 501 |
-
combined_system_msg += "[
|
| 502 |
combined_system_msg += """
|
| 503 |
-
[
|
| 504 |
-
1.
|
| 505 |
-
2.
|
| 506 |
-
3.
|
|
|
|
| 507 |
"""
|
| 508 |
else:
|
| 509 |
combined_system_msg += "[No valid keywords found, skipping WebSearch]\n\n"
|
|
@@ -541,7 +544,7 @@ def run(
|
|
| 541 |
|
| 542 |
streamer = TextIteratorStreamer(processor, timeout=30.0, skip_prompt=True, skip_special_tokens=True)
|
| 543 |
gen_kwargs = dict(
|
| 544 |
-
inputs
|
| 545 |
streamer=streamer,
|
| 546 |
max_new_tokens=max_new_tokens,
|
| 547 |
)
|
|
@@ -556,7 +559,7 @@ def run(
|
|
| 556 |
|
| 557 |
except Exception as e:
|
| 558 |
logger.error(f"Error in run: {str(e)}")
|
| 559 |
-
yield f"
|
| 560 |
|
| 561 |
finally:
|
| 562 |
# ์์ ํ์ผ ์ญ์
|
|
@@ -577,6 +580,7 @@ def run(
|
|
| 577 |
clear_cuda_cache()
|
| 578 |
|
| 579 |
|
|
|
|
| 580 |
##############################################################################
|
| 581 |
# ์์๋ค (๋ชจ๋ ์์ด๋ก)
|
| 582 |
##############################################################################
|
|
@@ -767,11 +771,12 @@ title_html = """
|
|
| 767 |
<h1 align="center" style="margin-bottom: 0.2em; font-size: 1.6em;"> ๐ค Gemma3-R1984-27B </h1>
|
| 768 |
<p align="center" style="font-size:1.1em; color:#555;">
|
| 769 |
โ
Agentic AI Platform โ
Reasoning & Uncensored โ
Multimodal & VLM โ
Deep-Research & RAG <br>
|
| 770 |
-
Operates on an NVIDIA A100 GPU as an independent local server, enhancing security and preventing information leakage.<br>
|
| 771 |
@Based by 'MS Gemma-3-27b' / @Powered by 'MOUSE-II'(VIDRAFT)
|
| 772 |
</p>
|
| 773 |
"""
|
| 774 |
|
|
|
|
| 775 |
with gr.Blocks(css=css, title="Gemma3-R1984-27B") as demo:
|
| 776 |
gr.Markdown(title_html)
|
| 777 |
|
|
|
|
| 125 |
summary_lines.append(
|
| 126 |
f"### Result {idx}: {title}\n\n"
|
| 127 |
f"{snippet}\n\n"
|
| 128 |
+
f"**์ถ์ฒ**: [{displayed_link}]({link})\n\n"
|
| 129 |
f"---\n"
|
| 130 |
)
|
| 131 |
|
| 132 |
# ๋ชจ๋ธ์๊ฒ ๋ช
ํํ ์ง์นจ ์ถ๊ฐ
|
| 133 |
instructions = """
|
| 134 |
+
# ์น ๊ฒ์ ๊ฒฐ๊ณผ
|
| 135 |
+
์๋๋ ๊ฒ์ ๊ฒฐ๊ณผ์
๋๋ค. ์ง๋ฌธ์ ๋ต๋ณํ ๋ ์ด ์ ๋ณด๋ฅผ ํ์ฉํ์ธ์:
|
| 136 |
+
1. ๊ฐ ๊ฒฐ๊ณผ์ ์ ๋ชฉ, ๋ด์ฉ, ์ถ์ฒ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ์ธ์
|
| 137 |
+
2. ๋ต๋ณ์ ๊ด๋ จ ์ ๋ณด์ ์ถ์ฒ๋ฅผ ๋ช
์์ ์ผ๋ก ์ธ์ฉํ์ธ์ (์: "X ์ถ์ฒ์ ๋ฐ๋ฅด๋ฉด...")
|
| 138 |
+
3. ์๋ต์ ์ค์ ์ถ์ฒ ๋งํฌ๋ฅผ ํฌํจํ์ธ์
|
| 139 |
+
4. ์ฌ๋ฌ ์ถ์ฒ์ ์ ๋ณด๋ฅผ ์ข
ํฉํ์ฌ ๋ต๋ณํ์ธ์
|
| 140 |
"""
|
| 141 |
|
| 142 |
search_results = instructions + "\n".join(summary_lines)
|
| 143 |
+
logger.info(f"๊ฒ์ ๊ฒฐ๊ณผ {len(limited_organic)}๊ฐ ์ฒ๋ฆฌ ์๋ฃ")
|
| 144 |
return search_results
|
| 145 |
|
| 146 |
except Exception as e:
|
|
|
|
| 500 |
ws_result = do_web_search(ws_query)
|
| 501 |
combined_system_msg += f"[Search top-20 Full Items Based on user prompt]\n{ws_result}\n\n"
|
| 502 |
# >>> ์ถ๊ฐ๋ ์๋ด ๋ฌธ๊ตฌ (๊ฒ์ ๊ฒฐ๊ณผ์ link ๋ฑ ์ถ์ฒ๋ฅผ ํ์ฉ)
|
| 503 |
+
combined_system_msg += "[์ฐธ๊ณ : ์ ๊ฒ์๊ฒฐ๊ณผ ๋ด์ฉ๊ณผ link๋ฅผ ์ถ์ฒ๋ก ์ธ์ฉํ์ฌ ๋ต๋ณํด ์ฃผ์ธ์.]\n\n"
|
| 504 |
combined_system_msg += """
|
| 505 |
+
[์ค์ ์ง์์ฌํญ]
|
| 506 |
+
1. ๋ต๋ณ์ ๊ฒ์ ๊ฒฐ๊ณผ์์ ์ฐพ์ ์ ๋ณด์ ์ถ์ฒ๋ฅผ ๋ฐ๋์ ์ธ์ฉํ์ธ์.
|
| 507 |
+
2. ์ถ์ฒ ์ธ์ฉ ์ "[์ถ์ฒ ์ ๋ชฉ](๋งํฌ)" ํ์์ ๋งํฌ๋ค์ด ๋งํฌ๋ฅผ ์ฌ์ฉํ์ธ์.
|
| 508 |
+
3. ์ฌ๋ฌ ์ถ์ฒ์ ์ ๋ณด๋ฅผ ์ข
ํฉํ์ฌ ๋ต๋ณํ์ธ์.
|
| 509 |
+
4. ๋ต๋ณ ๋ง์ง๋ง์ "์ฐธ๊ณ ์๋ฃ:" ์น์
์ ์ถ๊ฐํ๊ณ ์ฌ์ฉํ ์ฃผ์ ์ถ์ฒ ๋งํฌ๋ฅผ ๋์ดํ์ธ์.
|
| 510 |
"""
|
| 511 |
else:
|
| 512 |
combined_system_msg += "[No valid keywords found, skipping WebSearch]\n\n"
|
|
|
|
| 544 |
|
| 545 |
streamer = TextIteratorStreamer(processor, timeout=30.0, skip_prompt=True, skip_special_tokens=True)
|
| 546 |
gen_kwargs = dict(
|
| 547 |
+
inputs,
|
| 548 |
streamer=streamer,
|
| 549 |
max_new_tokens=max_new_tokens,
|
| 550 |
)
|
|
|
|
| 559 |
|
| 560 |
except Exception as e:
|
| 561 |
logger.error(f"Error in run: {str(e)}")
|
| 562 |
+
yield f"์ฃ์กํฉ๋๋ค. ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค: {str(e)}"
|
| 563 |
|
| 564 |
finally:
|
| 565 |
# ์์ ํ์ผ ์ญ์
|
|
|
|
| 580 |
clear_cuda_cache()
|
| 581 |
|
| 582 |
|
| 583 |
+
|
| 584 |
##############################################################################
|
| 585 |
# ์์๋ค (๋ชจ๋ ์์ด๋ก)
|
| 586 |
##############################################################################
|
|
|
|
| 771 |
<h1 align="center" style="margin-bottom: 0.2em; font-size: 1.6em;"> ๐ค Gemma3-R1984-27B </h1>
|
| 772 |
<p align="center" style="font-size:1.1em; color:#555;">
|
| 773 |
โ
Agentic AI Platform โ
Reasoning & Uncensored โ
Multimodal & VLM โ
Deep-Research & RAG <br>
|
| 774 |
+
Operates on an โ
'NVIDIA A100 GPU' as an independent local server, enhancing security and preventing information leakage.<br>
|
| 775 |
@Based by 'MS Gemma-3-27b' / @Powered by 'MOUSE-II'(VIDRAFT)
|
| 776 |
</p>
|
| 777 |
"""
|
| 778 |
|
| 779 |
+
|
| 780 |
with gr.Blocks(css=css, title="Gemma3-R1984-27B") as demo:
|
| 781 |
gr.Markdown(title_html)
|
| 782 |
|