Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
2456270
1
Parent(s):
52317b8
update
Browse files
controllers/gra_03_programfromdoc/programfromdoc.py
CHANGED
@@ -9,6 +9,7 @@ from dataclasses import dataclass, field
|
|
9 |
from typing import List, Optional
|
10 |
from mysite.interpreter.process import no_process_file,process_file
|
11 |
#from controllers.gra_04_database.rides import test_set_lide
|
|
|
12 |
|
13 |
val = """
|
14 |
# 社員がプロフィールを登録・公開し、お互いに参照できるシステム
|
@@ -95,9 +96,20 @@ fastapiはrouter の作成
|
|
95 |
|
96 |
"""
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
gradio_interface = gr.Interface(
|
100 |
-
fn=
|
101 |
inputs=[
|
102 |
"file",
|
103 |
gr.Textbox(label="Additional Notes", lines=10,value=val),
|
|
|
9 |
from typing import List, Optional
|
10 |
from mysite.interpreter.process import no_process_file,process_file
|
11 |
#from controllers.gra_04_database.rides import test_set_lide
|
12 |
+
import requests
|
13 |
|
14 |
val = """
|
15 |
# 社員がプロフィールを登録・公開し、お互いに参照できるシステム
|
|
|
96 |
|
97 |
"""
|
98 |
|
99 |
+
def send_to_google_chat(message: str):
|
100 |
+
webhook_url = 'https://chat.googleapis.com/v1/spaces/your-space-id/messages?key=your-key&token=your-token'
|
101 |
+
headers = {'Content-Type': 'application/json; charset=UTF-8'}
|
102 |
+
data = {'text': message}
|
103 |
+
response = requests.post(webhook_url, headers=headers, json=data)
|
104 |
+
response.raise_for_status()
|
105 |
+
|
106 |
+
def process_file_and_notify(*args, **kwargs):
|
107 |
+
result = process_file(*args, **kwargs)
|
108 |
+
send_to_google_chat(result)
|
109 |
+
return result
|
110 |
|
111 |
gradio_interface = gr.Interface(
|
112 |
+
fn=process_file_and_notify,
|
113 |
inputs=[
|
114 |
"file",
|
115 |
gr.Textbox(label="Additional Notes", lines=10,value=val),
|