Commit
·
d5d3bd0
0
Parent(s):
Initial commit with latest files
Browse files- .gitignore +4 -0
- README.md +1 -0
- __pycache__/chatAPI.cpython-38.pyc +0 -0
- __pycache__/main.cpython-38.pyc +0 -0
- chatAPI.py +29 -0
- chatbots/chatbot_base.py +68 -0
- chatbots/improvement_bot/chatbot.py +15 -0
- chatbots/improvement_bot/system.txt +5 -0
- chatbots/initialization_bot/chatbot.py +18 -0
- chatbots/initialization_bot/system.txt +12 -0
- chatbots/repolish_bot/chatbot.py +18 -0
- chatbots/repolish_bot/system.txt +5 -0
- component/gradio_iframe/__init__.py +4 -0
- component/gradio_iframe/iframe.py +78 -0
- component/gradio_iframe/iframe.pyi +126 -0
- component/gradio_iframe/templates/component/index.js +2091 -0
- component/gradio_iframe/templates/component/style.css +1 -0
- component/gradio_iframe/templates/example/index.js +89 -0
- component/gradio_iframe/templates/example/style.css +1 -0
- html_source/example.html +161 -0
- html_source/example2.html +127 -0
- html_source/experiment1.html +98 -0
- main.py +10 -0
- pages/__pycache__/home.cpython-38.pyc +0 -0
- pages/home.py +117 -0
- prompts.txt +3 -0
- requirements.txt +3 -0
- test.py +46 -0
- utils/debug.py +5 -0
- utils/tools.py +37 -0
.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__pycache__/
|
2 |
+
*.py[cod]
|
3 |
+
*$py.class
|
4 |
+
/config.yaml
|
README.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
"# UI2Code_Gradio"
|
__pycache__/chatAPI.cpython-38.pyc
ADDED
Binary file (886 Bytes). View file
|
|
__pycache__/main.cpython-38.pyc
ADDED
Binary file (1.84 kB). View file
|
|
chatAPI.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import httpx
|
2 |
+
from openai import OpenAI
|
3 |
+
proxy_url='http://127.0.0.1:10809'
|
4 |
+
|
5 |
+
models={'gpt4':'gpt-4-turbo','gpt4o-mini':'gpt-4o-mini'}
|
6 |
+
|
7 |
+
def chat(prompt):
|
8 |
+
client = OpenAI(http_client=httpx.Client(proxy=proxy_url))
|
9 |
+
|
10 |
+
completion = client.chat.completions.create(
|
11 |
+
model=models['gpt4'],
|
12 |
+
messages=prompt
|
13 |
+
)
|
14 |
+
return completion.choices[0].message.content
|
15 |
+
|
16 |
+
def process_input(message:str,base64_image=None,history=[]):
|
17 |
+
if base64_image:
|
18 |
+
new_conversation= history+[{
|
19 |
+
'role':'user',
|
20 |
+
'content':[
|
21 |
+
{'type':'text','text':message},
|
22 |
+
{'type':'image_url',"image_url": {
|
23 |
+
"url": f"data:image/jpeg;base64,{base64_image}",
|
24 |
+
"detail": "high"
|
25 |
+
}}
|
26 |
+
]
|
27 |
+
}]
|
28 |
+
return new_conversation
|
29 |
+
|
chatbots/chatbot_base.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Literal
|
2 |
+
from chatAPI import chat
|
3 |
+
from typing import Union
|
4 |
+
|
5 |
+
class ChatbotBase:
|
6 |
+
def __init__(self,system_prompt) -> None:
|
7 |
+
self.history=[]
|
8 |
+
self.system_prompt=''
|
9 |
+
self.set_system_prompt(system_prompt)
|
10 |
+
|
11 |
+
def set_system_prompt(self,prompt):
|
12 |
+
'''set system prompt. MUST BE used after reset_bot()'''
|
13 |
+
self.system_prompt=prompt
|
14 |
+
self.add_message(prompt,image=None,role='system')
|
15 |
+
|
16 |
+
def reset_bot(self):
|
17 |
+
self.history=[]
|
18 |
+
self.system_prompt=''
|
19 |
+
|
20 |
+
def add_message(self,message,image:Union[str,list[str]],role:Literal['user','assistant','system']):
|
21 |
+
'''add new message to history
|
22 |
+
image: base64 string of image
|
23 |
+
'''
|
24 |
+
if isinstance(image,list):
|
25 |
+
content=[]
|
26 |
+
content.append({'type':'text','text':message})
|
27 |
+
for img in image:
|
28 |
+
content.append({
|
29 |
+
'type':'image_url',
|
30 |
+
"image_url": {
|
31 |
+
"url": f"data:image/jpeg;base64,{image}",
|
32 |
+
"detail": "high"
|
33 |
+
}})
|
34 |
+
|
35 |
+
self.history.append({
|
36 |
+
'role':role,
|
37 |
+
'content':content})
|
38 |
+
elif image:
|
39 |
+
self.history.append({
|
40 |
+
'role':role,
|
41 |
+
'content':[
|
42 |
+
{'type':'text','text':message},
|
43 |
+
{'type':'image_url',"image_url": {
|
44 |
+
"url": f"data:image/jpeg;base64,{image}",
|
45 |
+
"detail": "high"
|
46 |
+
}}
|
47 |
+
]})
|
48 |
+
else:
|
49 |
+
self.history.append({
|
50 |
+
'role':role,
|
51 |
+
'content':message})
|
52 |
+
|
53 |
+
def pop_history(self):
|
54 |
+
'''remove last history message'''
|
55 |
+
self.history.pop()
|
56 |
+
|
57 |
+
def get_history(self):
|
58 |
+
return self.history
|
59 |
+
|
60 |
+
def generate(self):
|
61 |
+
'''generate new response and store to history'''
|
62 |
+
print('code generating')
|
63 |
+
rsp=chat(self.history)
|
64 |
+
self.add_message(rsp,image=None,role='assistant')
|
65 |
+
print(self.history)
|
66 |
+
return rsp
|
67 |
+
|
68 |
+
|
chatbots/improvement_bot/chatbot.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from chatbots.chatbot_base import ChatbotBase
|
2 |
+
from utils.tools import txt2string
|
3 |
+
|
4 |
+
|
5 |
+
class Chatbot(ChatbotBase):
|
6 |
+
def __init__(self) -> None:
|
7 |
+
super().__init__(txt2string('./chatbots/improvement_bot/system.txt'))
|
8 |
+
|
9 |
+
|
10 |
+
def generate_code(self,code,base64_img):
|
11 |
+
self.add_message('Generate improved the source code for a web page that looks exactly like this.\n'+code,base64_img,role='user')
|
12 |
+
return self.generate()
|
13 |
+
|
14 |
+
|
15 |
+
|
chatbots/improvement_bot/system.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
You are an expert CSS developer
|
2 |
+
You have developed a good base source code. Now, you have to improve it based on the reference image and base source code.
|
3 |
+
You have to make sure you code looks the same as the reference image.
|
4 |
+
You also have to make sure obey following rules:
|
5 |
+
- Do not include markdown "```" or "```html" at the start or end.
|
chatbots/initialization_bot/chatbot.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from chatbots.chatbot_base import ChatbotBase
|
2 |
+
from utils.tools import txt2string
|
3 |
+
from pathlib import Path
|
4 |
+
import os
|
5 |
+
|
6 |
+
current_dir = Path(__file__).resolve().parent
|
7 |
+
|
8 |
+
class Chatbot(ChatbotBase):
|
9 |
+
def __init__(self) -> None:
|
10 |
+
super().__init__(txt2string(os.path.join(current_dir,'system.txt')))
|
11 |
+
|
12 |
+
|
13 |
+
def generate_code(self,base64_img):
|
14 |
+
self.add_message('Generate code for a web page that looks exactly like this.\n',base64_img,role='user')
|
15 |
+
return self.generate()
|
16 |
+
|
17 |
+
|
18 |
+
|
chatbots/initialization_bot/system.txt
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
You are an expert CSS developer
|
2 |
+
You take screenshots of a reference web page from the user, and then build single page apps using CSS, HTML and JS.
|
3 |
+
You might also be given a screenshot(The second image) of a web page that you have already built, and asked to update it to look more like the reference image(The first image).
|
4 |
+
|
5 |
+
- Make sure the app looks exactly like the screenshot.
|
6 |
+
- Pay close attention to background color, text color, font size, font family, padding, margin, border, etc. Match the colors and sizes exactly.
|
7 |
+
- Use the exact text from the screenshot.
|
8 |
+
- Do not add comments in the code such as "<!-- Add other navigation links as needed -->" and "<!-- ... other news items ... -->" in place of writing the full code. WRITE THE FULL CODE.
|
9 |
+
- Repeat elements as needed to match the screenshot. For example, if there are 15 items, the code should have 15 items. DO NOT LEAVE comments like "<!-- Repeat for each news item -->" or bad things will happen.
|
10 |
+
- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later.\n\nIn terms of libraries,\n\n- You can use Google Fonts\n- Font Awesome for icons: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"></link>
|
11 |
+
Return only the full code in <html></html> tags.
|
12 |
+
- Do not include markdown "```" or "```html" at the start or end.
|
chatbots/repolish_bot/chatbot.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from chatbots.chatbot_base import ChatbotBase
|
2 |
+
from utils.tools import txt2string
|
3 |
+
from pathlib import Path
|
4 |
+
import os
|
5 |
+
|
6 |
+
current_dir = Path(__file__).resolve().parent
|
7 |
+
|
8 |
+
class Chatbot(ChatbotBase):
|
9 |
+
def __init__(self) -> None:
|
10 |
+
super().__init__(txt2string(os.path.join(current_dir,'system.txt')))
|
11 |
+
|
12 |
+
|
13 |
+
def generate_code(self,requirement,html_source,base64_img):
|
14 |
+
self.add_message('The first picture is the reference picture, and the last one is how the given source code looks.\n'+requirement+html_source,base64_img,role='user')
|
15 |
+
return self.generate()
|
16 |
+
|
17 |
+
|
18 |
+
|
chatbots/repolish_bot/system.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
You are an expert CSS developer
|
2 |
+
You have developed a good base source code. Now, you have to improve it based on the reference image and base source code.
|
3 |
+
You have to make sure you code looks the same as the reference image.
|
4 |
+
You also have to make sure obey following rules:
|
5 |
+
- Do not include markdown "```" or "```html" at the start or end.
|
component/gradio_iframe/__init__.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from .iframe import iFrame
|
3 |
+
|
4 |
+
__all__ = ['iFrame']
|
component/gradio_iframe/iframe.py
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""gr.HTML() component."""
|
2 |
+
|
3 |
+
from __future__ import annotations
|
4 |
+
|
5 |
+
from typing import Any, Callable
|
6 |
+
|
7 |
+
from gradio_client.documentation import document, set_documentation_group
|
8 |
+
|
9 |
+
from gradio.components.base import Component
|
10 |
+
from gradio.events import Events
|
11 |
+
|
12 |
+
set_documentation_group("component")
|
13 |
+
|
14 |
+
|
15 |
+
@document()
|
16 |
+
class iFrame(Component):
|
17 |
+
"""
|
18 |
+
Used to display abitrary html output.
|
19 |
+
Preprocessing: this component does *not* accept input.
|
20 |
+
Postprocessing: expects a valid HTML {str}.
|
21 |
+
|
22 |
+
Demos: text_analysis
|
23 |
+
Guides: key-features
|
24 |
+
"""
|
25 |
+
|
26 |
+
EVENTS = [Events.change]
|
27 |
+
|
28 |
+
def __init__(
|
29 |
+
self,
|
30 |
+
value: str | Callable = "",
|
31 |
+
*,
|
32 |
+
label: str | None = None,
|
33 |
+
every: float | None = None,
|
34 |
+
show_label: bool | None = None,
|
35 |
+
visible: bool = True,
|
36 |
+
elem_id: str | None = None,
|
37 |
+
elem_classes: list[str] | str | None = None,
|
38 |
+
render: bool = True,
|
39 |
+
height: str | None = None,
|
40 |
+
width: str | None = None,
|
41 |
+
):
|
42 |
+
"""
|
43 |
+
Parameters:
|
44 |
+
value: Default value. If callable, the function will be called whenever the app loads to set the initial value of the component.
|
45 |
+
label: The label for this component. Is used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
|
46 |
+
every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
|
47 |
+
show_label: This parameter has no effect.
|
48 |
+
visible: If False, component will be hidden.
|
49 |
+
elem_id: An optional string that is assigned as the id of this component in the iFrame DOM. Can be used for targeting CSS styles.
|
50 |
+
elem_classes: An optional list of strings that are assigned as the classes of this component in the iFrame DOM. Can be used for targeting CSS styles.
|
51 |
+
render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
52 |
+
height: The height of the iFrame in valid css (i.e "10px). If None, the height will be automatically set to 100%
|
53 |
+
"""
|
54 |
+
super().__init__(
|
55 |
+
label=label,
|
56 |
+
every=every,
|
57 |
+
show_label=show_label,
|
58 |
+
visible=visible,
|
59 |
+
elem_id=elem_id,
|
60 |
+
elem_classes=elem_classes,
|
61 |
+
render=render,
|
62 |
+
value=value,
|
63 |
+
)
|
64 |
+
|
65 |
+
self.height = height
|
66 |
+
self.width = width
|
67 |
+
|
68 |
+
def example_inputs(self) -> Any:
|
69 |
+
return """<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ?si=QfHLpHZsI98oZT1G" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>"""
|
70 |
+
|
71 |
+
def preprocess(self, payload: str | None) -> str | None:
|
72 |
+
return payload
|
73 |
+
|
74 |
+
def postprocess(self, value: str | None) -> str | None:
|
75 |
+
return value
|
76 |
+
|
77 |
+
def api_info(self) -> dict[str, Any]:
|
78 |
+
return {"type": "string"}
|
component/gradio_iframe/iframe.pyi
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""gr.HTML() component."""
|
2 |
+
|
3 |
+
from __future__ import annotations
|
4 |
+
|
5 |
+
from typing import Any, Callable
|
6 |
+
|
7 |
+
from gradio_client.documentation import document, set_documentation_group
|
8 |
+
|
9 |
+
from gradio.components.base import Component
|
10 |
+
from gradio.events import Events
|
11 |
+
|
12 |
+
set_documentation_group("component")
|
13 |
+
|
14 |
+
from gradio.events import Dependency
|
15 |
+
|
16 |
+
@document()
|
17 |
+
class iFrame(Component):
|
18 |
+
"""
|
19 |
+
Used to display abitrary html output.
|
20 |
+
Preprocessing: this component does *not* accept input.
|
21 |
+
Postprocessing: expects a valid HTML {str}.
|
22 |
+
|
23 |
+
Demos: text_analysis
|
24 |
+
Guides: key-features
|
25 |
+
"""
|
26 |
+
|
27 |
+
EVENTS = [Events.change]
|
28 |
+
|
29 |
+
def __init__(
|
30 |
+
self,
|
31 |
+
value: str | Callable = "",
|
32 |
+
*,
|
33 |
+
label: str | None = None,
|
34 |
+
every: float | None = None,
|
35 |
+
show_label: bool | None = None,
|
36 |
+
visible: bool = True,
|
37 |
+
elem_id: str | None = None,
|
38 |
+
elem_classes: list[str] | str | None = None,
|
39 |
+
render: bool = True,
|
40 |
+
height: str | None = None,
|
41 |
+
width: str | None = None,
|
42 |
+
):
|
43 |
+
"""
|
44 |
+
Parameters:
|
45 |
+
value: Default value. If callable, the function will be called whenever the app loads to set the initial value of the component.
|
46 |
+
label: The label for this component. Is used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
|
47 |
+
every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
|
48 |
+
show_label: This parameter has no effect.
|
49 |
+
visible: If False, component will be hidden.
|
50 |
+
elem_id: An optional string that is assigned as the id of this component in the iFrame DOM. Can be used for targeting CSS styles.
|
51 |
+
elem_classes: An optional list of strings that are assigned as the classes of this component in the iFrame DOM. Can be used for targeting CSS styles.
|
52 |
+
render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
|
53 |
+
height: The height of the iFrame in valid css (i.e "10px). If None, the height will be automatically set to 100%
|
54 |
+
"""
|
55 |
+
super().__init__(
|
56 |
+
label=label,
|
57 |
+
every=every,
|
58 |
+
show_label=show_label,
|
59 |
+
visible=visible,
|
60 |
+
elem_id=elem_id,
|
61 |
+
elem_classes=elem_classes,
|
62 |
+
render=render,
|
63 |
+
value=value,
|
64 |
+
)
|
65 |
+
|
66 |
+
self.height = height
|
67 |
+
self.width = width
|
68 |
+
|
69 |
+
def example_inputs(self) -> Any:
|
70 |
+
return """<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ?si=QfHLpHZsI98oZT1G" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>"""
|
71 |
+
|
72 |
+
def preprocess(self, payload: str | None) -> str | None:
|
73 |
+
return payload
|
74 |
+
|
75 |
+
def postprocess(self, value: str | None) -> str | None:
|
76 |
+
return value
|
77 |
+
|
78 |
+
def api_info(self) -> dict[str, Any]:
|
79 |
+
return {"type": "string"}
|
80 |
+
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
81 |
+
from gradio.blocks import Block
|
82 |
+
if TYPE_CHECKING:
|
83 |
+
from gradio.components import Timer
|
84 |
+
|
85 |
+
|
86 |
+
def change(self,
|
87 |
+
fn: Callable[..., Any] | None = None,
|
88 |
+
inputs: Block | Sequence[Block] | set[Block] | None = None,
|
89 |
+
outputs: Block | Sequence[Block] | None = None,
|
90 |
+
api_name: str | None | Literal[False] = None,
|
91 |
+
scroll_to_output: bool = False,
|
92 |
+
show_progress: Literal["full", "minimal", "hidden"] = "full",
|
93 |
+
queue: bool | None = None,
|
94 |
+
batch: bool = False,
|
95 |
+
max_batch_size: int = 4,
|
96 |
+
preprocess: bool = True,
|
97 |
+
postprocess: bool = True,
|
98 |
+
cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
|
99 |
+
every: Timer | float | None = None,
|
100 |
+
trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
|
101 |
+
js: str | None = None,
|
102 |
+
concurrency_limit: int | None | Literal["default"] = "default",
|
103 |
+
concurrency_id: str | None = None,
|
104 |
+
show_api: bool = True) -> Dependency:
|
105 |
+
"""
|
106 |
+
Parameters:
|
107 |
+
fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
|
108 |
+
inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
|
109 |
+
outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
|
110 |
+
api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
|
111 |
+
scroll_to_output: if True, will scroll to output component on completion
|
112 |
+
show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
|
113 |
+
queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
|
114 |
+
batch: if True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
|
115 |
+
max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
|
116 |
+
preprocess: if False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
|
117 |
+
postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
|
118 |
+
cancels: a list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
|
119 |
+
every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
|
120 |
+
trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
|
121 |
+
js: optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
|
122 |
+
concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
|
123 |
+
concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
|
124 |
+
show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
|
125 |
+
"""
|
126 |
+
...
|
component/gradio_iframe/templates/component/index.js
ADDED
@@ -0,0 +1,2091 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const {
|
2 |
+
SvelteComponent: nt,
|
3 |
+
append: it,
|
4 |
+
attr: T,
|
5 |
+
binding_callbacks: ft,
|
6 |
+
detach: st,
|
7 |
+
element: we,
|
8 |
+
init: ot,
|
9 |
+
insert: at,
|
10 |
+
listen: rt,
|
11 |
+
noop: ve,
|
12 |
+
safe_not_equal: _t,
|
13 |
+
toggle_class: X
|
14 |
+
} = window.__gradio__svelte__internal, { createEventDispatcher: ut } = window.__gradio__svelte__internal;
|
15 |
+
function ct(n) {
|
16 |
+
let t, e, l, i, s;
|
17 |
+
return {
|
18 |
+
c() {
|
19 |
+
t = we("div"), e = we("iframe"), T(e, "title", "iframe component"), T(
|
20 |
+
e,
|
21 |
+
"width",
|
22 |
+
/*width*/
|
23 |
+
n[5]
|
24 |
+
), T(
|
25 |
+
e,
|
26 |
+
"srcdoc",
|
27 |
+
/*value*/
|
28 |
+
n[1]
|
29 |
+
), T(
|
30 |
+
e,
|
31 |
+
"height",
|
32 |
+
/*height*/
|
33 |
+
n[4]
|
34 |
+
), T(e, "allow", "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"), e.allowFullscreen = !0, T(t, "class", l = "prose " + /*elem_classes*/
|
35 |
+
n[0].join(" ") + " svelte-2qygph"), X(
|
36 |
+
t,
|
37 |
+
"min",
|
38 |
+
/*min_height*/
|
39 |
+
n[3]
|
40 |
+
), X(t, "hide", !/*visible*/
|
41 |
+
n[2]), X(
|
42 |
+
t,
|
43 |
+
"height",
|
44 |
+
/*height*/
|
45 |
+
n[4]
|
46 |
+
);
|
47 |
+
},
|
48 |
+
m(o, a) {
|
49 |
+
at(o, t, a), it(t, e), n[8](e), i || (s = rt(
|
50 |
+
e,
|
51 |
+
"load",
|
52 |
+
/*onLoad*/
|
53 |
+
n[7]
|
54 |
+
), i = !0);
|
55 |
+
},
|
56 |
+
p(o, [a]) {
|
57 |
+
a & /*width*/
|
58 |
+
32 && T(
|
59 |
+
e,
|
60 |
+
"width",
|
61 |
+
/*width*/
|
62 |
+
o[5]
|
63 |
+
), a & /*value*/
|
64 |
+
2 && T(
|
65 |
+
e,
|
66 |
+
"srcdoc",
|
67 |
+
/*value*/
|
68 |
+
o[1]
|
69 |
+
), a & /*height*/
|
70 |
+
16 && T(
|
71 |
+
e,
|
72 |
+
"height",
|
73 |
+
/*height*/
|
74 |
+
o[4]
|
75 |
+
), a & /*elem_classes*/
|
76 |
+
1 && l !== (l = "prose " + /*elem_classes*/
|
77 |
+
o[0].join(" ") + " svelte-2qygph") && T(t, "class", l), a & /*elem_classes, min_height*/
|
78 |
+
9 && X(
|
79 |
+
t,
|
80 |
+
"min",
|
81 |
+
/*min_height*/
|
82 |
+
o[3]
|
83 |
+
), a & /*elem_classes, visible*/
|
84 |
+
5 && X(t, "hide", !/*visible*/
|
85 |
+
o[2]), a & /*elem_classes, height*/
|
86 |
+
17 && X(
|
87 |
+
t,
|
88 |
+
"height",
|
89 |
+
/*height*/
|
90 |
+
o[4]
|
91 |
+
);
|
92 |
+
},
|
93 |
+
i: ve,
|
94 |
+
o: ve,
|
95 |
+
d(o) {
|
96 |
+
o && st(t), n[8](null), i = !1, s();
|
97 |
+
}
|
98 |
+
};
|
99 |
+
}
|
100 |
+
function dt(n, t, e) {
|
101 |
+
let { elem_classes: l = [] } = t, { value: i } = t, { visible: s = !0 } = t, { min_height: o = !1 } = t, { height: a = "100%" } = t, { width: r = "100%" } = t;
|
102 |
+
const f = ut();
|
103 |
+
let _;
|
104 |
+
const m = () => {
|
105 |
+
try {
|
106 |
+
const u = _.contentDocument || _.contentWindow.document;
|
107 |
+
a === "100%" ? e(6, _.style.height = `${u.documentElement.scrollHeight}px`, _) : e(6, _.style.height = a, _);
|
108 |
+
} catch (u) {
|
109 |
+
console.error("Error accessing iframe content:", u);
|
110 |
+
}
|
111 |
+
};
|
112 |
+
function b(u) {
|
113 |
+
ft[u ? "unshift" : "push"](() => {
|
114 |
+
_ = u, e(6, _);
|
115 |
+
});
|
116 |
+
}
|
117 |
+
return n.$$set = (u) => {
|
118 |
+
"elem_classes" in u && e(0, l = u.elem_classes), "value" in u && e(1, i = u.value), "visible" in u && e(2, s = u.visible), "min_height" in u && e(3, o = u.min_height), "height" in u && e(4, a = u.height), "width" in u && e(5, r = u.width);
|
119 |
+
}, n.$$.update = () => {
|
120 |
+
n.$$.dirty & /*value*/
|
121 |
+
2 && f("change");
|
122 |
+
}, [
|
123 |
+
l,
|
124 |
+
i,
|
125 |
+
s,
|
126 |
+
o,
|
127 |
+
a,
|
128 |
+
r,
|
129 |
+
_,
|
130 |
+
m,
|
131 |
+
b
|
132 |
+
];
|
133 |
+
}
|
134 |
+
class mt extends nt {
|
135 |
+
constructor(t) {
|
136 |
+
super(), ot(this, t, dt, ct, _t, {
|
137 |
+
elem_classes: 0,
|
138 |
+
value: 1,
|
139 |
+
visible: 2,
|
140 |
+
min_height: 3,
|
141 |
+
height: 4,
|
142 |
+
width: 5
|
143 |
+
});
|
144 |
+
}
|
145 |
+
}
|
146 |
+
function G(n) {
|
147 |
+
let t = ["", "k", "M", "G", "T", "P", "E", "Z"], e = 0;
|
148 |
+
for (; n > 1e3 && e < t.length - 1; )
|
149 |
+
n /= 1e3, e++;
|
150 |
+
let l = t[e];
|
151 |
+
return (Number.isInteger(n) ? n : n.toFixed(1)) + l;
|
152 |
+
}
|
153 |
+
function te() {
|
154 |
+
}
|
155 |
+
function bt(n, t) {
|
156 |
+
return n != n ? t == t : n !== t || n && typeof n == "object" || typeof n == "function";
|
157 |
+
}
|
158 |
+
const Re = typeof window < "u";
|
159 |
+
let ke = Re ? () => window.performance.now() : () => Date.now(), Ue = Re ? (n) => requestAnimationFrame(n) : te;
|
160 |
+
const O = /* @__PURE__ */ new Set();
|
161 |
+
function We(n) {
|
162 |
+
O.forEach((t) => {
|
163 |
+
t.c(n) || (O.delete(t), t.f());
|
164 |
+
}), O.size !== 0 && Ue(We);
|
165 |
+
}
|
166 |
+
function gt(n) {
|
167 |
+
let t;
|
168 |
+
return O.size === 0 && Ue(We), {
|
169 |
+
promise: new Promise((e) => {
|
170 |
+
O.add(t = { c: n, f: e });
|
171 |
+
}),
|
172 |
+
abort() {
|
173 |
+
O.delete(t);
|
174 |
+
}
|
175 |
+
};
|
176 |
+
}
|
177 |
+
const Y = [];
|
178 |
+
function ht(n, t = te) {
|
179 |
+
let e;
|
180 |
+
const l = /* @__PURE__ */ new Set();
|
181 |
+
function i(a) {
|
182 |
+
if (bt(n, a) && (n = a, e)) {
|
183 |
+
const r = !Y.length;
|
184 |
+
for (const f of l)
|
185 |
+
f[1](), Y.push(f, n);
|
186 |
+
if (r) {
|
187 |
+
for (let f = 0; f < Y.length; f += 2)
|
188 |
+
Y[f][0](Y[f + 1]);
|
189 |
+
Y.length = 0;
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
function s(a) {
|
194 |
+
i(a(n));
|
195 |
+
}
|
196 |
+
function o(a, r = te) {
|
197 |
+
const f = [a, r];
|
198 |
+
return l.add(f), l.size === 1 && (e = t(i, s) || te), a(n), () => {
|
199 |
+
l.delete(f), l.size === 0 && e && (e(), e = null);
|
200 |
+
};
|
201 |
+
}
|
202 |
+
return { set: i, update: s, subscribe: o };
|
203 |
+
}
|
204 |
+
function ye(n) {
|
205 |
+
return Object.prototype.toString.call(n) === "[object Date]";
|
206 |
+
}
|
207 |
+
function se(n, t, e, l) {
|
208 |
+
if (typeof e == "number" || ye(e)) {
|
209 |
+
const i = l - e, s = (e - t) / (n.dt || 1 / 60), o = n.opts.stiffness * i, a = n.opts.damping * s, r = (o - a) * n.inv_mass, f = (s + r) * n.dt;
|
210 |
+
return Math.abs(f) < n.opts.precision && Math.abs(i) < n.opts.precision ? l : (n.settled = !1, ye(e) ? new Date(e.getTime() + f) : e + f);
|
211 |
+
} else {
|
212 |
+
if (Array.isArray(e))
|
213 |
+
return e.map(
|
214 |
+
(i, s) => se(n, t[s], e[s], l[s])
|
215 |
+
);
|
216 |
+
if (typeof e == "object") {
|
217 |
+
const i = {};
|
218 |
+
for (const s in e)
|
219 |
+
i[s] = se(n, t[s], e[s], l[s]);
|
220 |
+
return i;
|
221 |
+
} else
|
222 |
+
throw new Error(`Cannot spring ${typeof e} values`);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
function pe(n, t = {}) {
|
226 |
+
const e = ht(n), { stiffness: l = 0.15, damping: i = 0.8, precision: s = 0.01 } = t;
|
227 |
+
let o, a, r, f = n, _ = n, m = 1, b = 0, u = !1;
|
228 |
+
function k(p, L = {}) {
|
229 |
+
_ = p;
|
230 |
+
const F = r = {};
|
231 |
+
return n == null || L.hard || C.stiffness >= 1 && C.damping >= 1 ? (u = !0, o = ke(), f = p, e.set(n = _), Promise.resolve()) : (L.soft && (b = 1 / ((L.soft === !0 ? 0.5 : +L.soft) * 60), m = 0), a || (o = ke(), u = !1, a = gt((c) => {
|
232 |
+
if (u)
|
233 |
+
return u = !1, a = null, !1;
|
234 |
+
m = Math.min(m + b, 1);
|
235 |
+
const y = {
|
236 |
+
inv_mass: m,
|
237 |
+
opts: C,
|
238 |
+
settled: !0,
|
239 |
+
dt: (c - o) * 60 / 1e3
|
240 |
+
}, g = se(y, f, n, _);
|
241 |
+
return o = c, f = n, e.set(n = g), y.settled && (a = null), !y.settled;
|
242 |
+
})), new Promise((c) => {
|
243 |
+
a.promise.then(() => {
|
244 |
+
F === r && c();
|
245 |
+
});
|
246 |
+
}));
|
247 |
+
}
|
248 |
+
const C = {
|
249 |
+
set: k,
|
250 |
+
update: (p, L) => k(p(_, n), L),
|
251 |
+
subscribe: e.subscribe,
|
252 |
+
stiffness: l,
|
253 |
+
damping: i,
|
254 |
+
precision: s
|
255 |
+
};
|
256 |
+
return C;
|
257 |
+
}
|
258 |
+
const {
|
259 |
+
SvelteComponent: wt,
|
260 |
+
append: N,
|
261 |
+
attr: v,
|
262 |
+
component_subscribe: qe,
|
263 |
+
detach: vt,
|
264 |
+
element: kt,
|
265 |
+
init: yt,
|
266 |
+
insert: pt,
|
267 |
+
noop: Fe,
|
268 |
+
safe_not_equal: qt,
|
269 |
+
set_style: $,
|
270 |
+
svg_element: z,
|
271 |
+
toggle_class: Le
|
272 |
+
} = window.__gradio__svelte__internal, { onMount: Ft } = window.__gradio__svelte__internal;
|
273 |
+
function Lt(n) {
|
274 |
+
let t, e, l, i, s, o, a, r, f, _, m, b;
|
275 |
+
return {
|
276 |
+
c() {
|
277 |
+
t = kt("div"), e = z("svg"), l = z("g"), i = z("path"), s = z("path"), o = z("path"), a = z("path"), r = z("g"), f = z("path"), _ = z("path"), m = z("path"), b = z("path"), v(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), v(i, "fill", "#FF7C00"), v(i, "fill-opacity", "0.4"), v(i, "class", "svelte-43sxxs"), v(s, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), v(s, "fill", "#FF7C00"), v(s, "class", "svelte-43sxxs"), v(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), v(o, "fill", "#FF7C00"), v(o, "fill-opacity", "0.4"), v(o, "class", "svelte-43sxxs"), v(a, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), v(a, "fill", "#FF7C00"), v(a, "class", "svelte-43sxxs"), $(l, "transform", "translate(" + /*$top*/
|
278 |
+
n[1][0] + "px, " + /*$top*/
|
279 |
+
n[1][1] + "px)"), v(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), v(f, "fill", "#FF7C00"), v(f, "fill-opacity", "0.4"), v(f, "class", "svelte-43sxxs"), v(_, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), v(_, "fill", "#FF7C00"), v(_, "class", "svelte-43sxxs"), v(m, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), v(m, "fill", "#FF7C00"), v(m, "fill-opacity", "0.4"), v(m, "class", "svelte-43sxxs"), v(b, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), v(b, "fill", "#FF7C00"), v(b, "class", "svelte-43sxxs"), $(r, "transform", "translate(" + /*$bottom*/
|
280 |
+
n[2][0] + "px, " + /*$bottom*/
|
281 |
+
n[2][1] + "px)"), v(e, "viewBox", "-1200 -1200 3000 3000"), v(e, "fill", "none"), v(e, "xmlns", "http://www.w3.org/2000/svg"), v(e, "class", "svelte-43sxxs"), v(t, "class", "svelte-43sxxs"), Le(
|
282 |
+
t,
|
283 |
+
"margin",
|
284 |
+
/*margin*/
|
285 |
+
n[0]
|
286 |
+
);
|
287 |
+
},
|
288 |
+
m(u, k) {
|
289 |
+
pt(u, t, k), N(t, e), N(e, l), N(l, i), N(l, s), N(l, o), N(l, a), N(e, r), N(r, f), N(r, _), N(r, m), N(r, b);
|
290 |
+
},
|
291 |
+
p(u, [k]) {
|
292 |
+
k & /*$top*/
|
293 |
+
2 && $(l, "transform", "translate(" + /*$top*/
|
294 |
+
u[1][0] + "px, " + /*$top*/
|
295 |
+
u[1][1] + "px)"), k & /*$bottom*/
|
296 |
+
4 && $(r, "transform", "translate(" + /*$bottom*/
|
297 |
+
u[2][0] + "px, " + /*$bottom*/
|
298 |
+
u[2][1] + "px)"), k & /*margin*/
|
299 |
+
1 && Le(
|
300 |
+
t,
|
301 |
+
"margin",
|
302 |
+
/*margin*/
|
303 |
+
u[0]
|
304 |
+
);
|
305 |
+
},
|
306 |
+
i: Fe,
|
307 |
+
o: Fe,
|
308 |
+
d(u) {
|
309 |
+
u && vt(t);
|
310 |
+
}
|
311 |
+
};
|
312 |
+
}
|
313 |
+
function Ct(n, t, e) {
|
314 |
+
let l, i, { margin: s = !0 } = t;
|
315 |
+
const o = pe([0, 0]);
|
316 |
+
qe(n, o, (b) => e(1, l = b));
|
317 |
+
const a = pe([0, 0]);
|
318 |
+
qe(n, a, (b) => e(2, i = b));
|
319 |
+
let r;
|
320 |
+
async function f() {
|
321 |
+
await Promise.all([o.set([125, 140]), a.set([-125, -140])]), await Promise.all([o.set([-125, 140]), a.set([125, -140])]), await Promise.all([o.set([-125, 0]), a.set([125, -0])]), await Promise.all([o.set([125, 0]), a.set([-125, 0])]);
|
322 |
+
}
|
323 |
+
async function _() {
|
324 |
+
await f(), r || _();
|
325 |
+
}
|
326 |
+
async function m() {
|
327 |
+
await Promise.all([o.set([125, 0]), a.set([-125, 0])]), _();
|
328 |
+
}
|
329 |
+
return Ft(() => (m(), () => r = !0)), n.$$set = (b) => {
|
330 |
+
"margin" in b && e(0, s = b.margin);
|
331 |
+
}, [s, l, i, o, a];
|
332 |
+
}
|
333 |
+
class Mt extends wt {
|
334 |
+
constructor(t) {
|
335 |
+
super(), yt(this, t, Ct, Lt, qt, { margin: 0 });
|
336 |
+
}
|
337 |
+
}
|
338 |
+
const {
|
339 |
+
SvelteComponent: Vt,
|
340 |
+
append: H,
|
341 |
+
attr: j,
|
342 |
+
binding_callbacks: Ce,
|
343 |
+
check_outros: Je,
|
344 |
+
create_component: St,
|
345 |
+
create_slot: Nt,
|
346 |
+
destroy_component: zt,
|
347 |
+
destroy_each: Ke,
|
348 |
+
detach: h,
|
349 |
+
element: Z,
|
350 |
+
empty: W,
|
351 |
+
ensure_array_like: le,
|
352 |
+
get_all_dirty_from_scope: Tt,
|
353 |
+
get_slot_changes: jt,
|
354 |
+
group_outros: Qe,
|
355 |
+
init: Pt,
|
356 |
+
insert: w,
|
357 |
+
mount_component: Zt,
|
358 |
+
noop: oe,
|
359 |
+
safe_not_equal: Dt,
|
360 |
+
set_data: S,
|
361 |
+
set_style: B,
|
362 |
+
space: P,
|
363 |
+
text: q,
|
364 |
+
toggle_class: V,
|
365 |
+
transition_in: R,
|
366 |
+
transition_out: U,
|
367 |
+
update_slot_base: Et
|
368 |
+
} = window.__gradio__svelte__internal, { tick: Bt } = window.__gradio__svelte__internal, { onDestroy: At } = window.__gradio__svelte__internal, It = (n) => ({}), Me = (n) => ({});
|
369 |
+
function Ve(n, t, e) {
|
370 |
+
const l = n.slice();
|
371 |
+
return l[38] = t[e], l[40] = e, l;
|
372 |
+
}
|
373 |
+
function Se(n, t, e) {
|
374 |
+
const l = n.slice();
|
375 |
+
return l[38] = t[e], l;
|
376 |
+
}
|
377 |
+
function Ht(n) {
|
378 |
+
let t, e = (
|
379 |
+
/*i18n*/
|
380 |
+
n[1]("common.error") + ""
|
381 |
+
), l, i, s;
|
382 |
+
const o = (
|
383 |
+
/*#slots*/
|
384 |
+
n[29].error
|
385 |
+
), a = Nt(
|
386 |
+
o,
|
387 |
+
n,
|
388 |
+
/*$$scope*/
|
389 |
+
n[28],
|
390 |
+
Me
|
391 |
+
);
|
392 |
+
return {
|
393 |
+
c() {
|
394 |
+
t = Z("span"), l = q(e), i = P(), a && a.c(), j(t, "class", "error svelte-1txqlrd");
|
395 |
+
},
|
396 |
+
m(r, f) {
|
397 |
+
w(r, t, f), H(t, l), w(r, i, f), a && a.m(r, f), s = !0;
|
398 |
+
},
|
399 |
+
p(r, f) {
|
400 |
+
(!s || f[0] & /*i18n*/
|
401 |
+
2) && e !== (e = /*i18n*/
|
402 |
+
r[1]("common.error") + "") && S(l, e), a && a.p && (!s || f[0] & /*$$scope*/
|
403 |
+
268435456) && Et(
|
404 |
+
a,
|
405 |
+
o,
|
406 |
+
r,
|
407 |
+
/*$$scope*/
|
408 |
+
r[28],
|
409 |
+
s ? jt(
|
410 |
+
o,
|
411 |
+
/*$$scope*/
|
412 |
+
r[28],
|
413 |
+
f,
|
414 |
+
It
|
415 |
+
) : Tt(
|
416 |
+
/*$$scope*/
|
417 |
+
r[28]
|
418 |
+
),
|
419 |
+
Me
|
420 |
+
);
|
421 |
+
},
|
422 |
+
i(r) {
|
423 |
+
s || (R(a, r), s = !0);
|
424 |
+
},
|
425 |
+
o(r) {
|
426 |
+
U(a, r), s = !1;
|
427 |
+
},
|
428 |
+
d(r) {
|
429 |
+
r && (h(t), h(i)), a && a.d(r);
|
430 |
+
}
|
431 |
+
};
|
432 |
+
}
|
433 |
+
function Xt(n) {
|
434 |
+
let t, e, l, i, s, o, a, r, f, _ = (
|
435 |
+
/*variant*/
|
436 |
+
n[8] === "default" && /*show_eta_bar*/
|
437 |
+
n[18] && /*show_progress*/
|
438 |
+
n[6] === "full" && Ne(n)
|
439 |
+
);
|
440 |
+
function m(c, y) {
|
441 |
+
if (
|
442 |
+
/*progress*/
|
443 |
+
c[7]
|
444 |
+
)
|
445 |
+
return Ot;
|
446 |
+
if (
|
447 |
+
/*queue_position*/
|
448 |
+
c[2] !== null && /*queue_size*/
|
449 |
+
c[3] !== void 0 && /*queue_position*/
|
450 |
+
c[2] >= 0
|
451 |
+
)
|
452 |
+
return Gt;
|
453 |
+
if (
|
454 |
+
/*queue_position*/
|
455 |
+
c[2] === 0
|
456 |
+
)
|
457 |
+
return Yt;
|
458 |
+
}
|
459 |
+
let b = m(n), u = b && b(n), k = (
|
460 |
+
/*timer*/
|
461 |
+
n[5] && je(n)
|
462 |
+
);
|
463 |
+
const C = [Jt, Wt], p = [];
|
464 |
+
function L(c, y) {
|
465 |
+
return (
|
466 |
+
/*last_progress_level*/
|
467 |
+
c[15] != null ? 0 : (
|
468 |
+
/*show_progress*/
|
469 |
+
c[6] === "full" ? 1 : -1
|
470 |
+
)
|
471 |
+
);
|
472 |
+
}
|
473 |
+
~(s = L(n)) && (o = p[s] = C[s](n));
|
474 |
+
let F = !/*timer*/
|
475 |
+
n[5] && Ie(n);
|
476 |
+
return {
|
477 |
+
c() {
|
478 |
+
_ && _.c(), t = P(), e = Z("div"), u && u.c(), l = P(), k && k.c(), i = P(), o && o.c(), a = P(), F && F.c(), r = W(), j(e, "class", "progress-text svelte-1txqlrd"), V(
|
479 |
+
e,
|
480 |
+
"meta-text-center",
|
481 |
+
/*variant*/
|
482 |
+
n[8] === "center"
|
483 |
+
), V(
|
484 |
+
e,
|
485 |
+
"meta-text",
|
486 |
+
/*variant*/
|
487 |
+
n[8] === "default"
|
488 |
+
);
|
489 |
+
},
|
490 |
+
m(c, y) {
|
491 |
+
_ && _.m(c, y), w(c, t, y), w(c, e, y), u && u.m(e, null), H(e, l), k && k.m(e, null), w(c, i, y), ~s && p[s].m(c, y), w(c, a, y), F && F.m(c, y), w(c, r, y), f = !0;
|
492 |
+
},
|
493 |
+
p(c, y) {
|
494 |
+
/*variant*/
|
495 |
+
c[8] === "default" && /*show_eta_bar*/
|
496 |
+
c[18] && /*show_progress*/
|
497 |
+
c[6] === "full" ? _ ? _.p(c, y) : (_ = Ne(c), _.c(), _.m(t.parentNode, t)) : _ && (_.d(1), _ = null), b === (b = m(c)) && u ? u.p(c, y) : (u && u.d(1), u = b && b(c), u && (u.c(), u.m(e, l))), /*timer*/
|
498 |
+
c[5] ? k ? k.p(c, y) : (k = je(c), k.c(), k.m(e, null)) : k && (k.d(1), k = null), (!f || y[0] & /*variant*/
|
499 |
+
256) && V(
|
500 |
+
e,
|
501 |
+
"meta-text-center",
|
502 |
+
/*variant*/
|
503 |
+
c[8] === "center"
|
504 |
+
), (!f || y[0] & /*variant*/
|
505 |
+
256) && V(
|
506 |
+
e,
|
507 |
+
"meta-text",
|
508 |
+
/*variant*/
|
509 |
+
c[8] === "default"
|
510 |
+
);
|
511 |
+
let g = s;
|
512 |
+
s = L(c), s === g ? ~s && p[s].p(c, y) : (o && (Qe(), U(p[g], 1, 1, () => {
|
513 |
+
p[g] = null;
|
514 |
+
}), Je()), ~s ? (o = p[s], o ? o.p(c, y) : (o = p[s] = C[s](c), o.c()), R(o, 1), o.m(a.parentNode, a)) : o = null), /*timer*/
|
515 |
+
c[5] ? F && (F.d(1), F = null) : F ? F.p(c, y) : (F = Ie(c), F.c(), F.m(r.parentNode, r));
|
516 |
+
},
|
517 |
+
i(c) {
|
518 |
+
f || (R(o), f = !0);
|
519 |
+
},
|
520 |
+
o(c) {
|
521 |
+
U(o), f = !1;
|
522 |
+
},
|
523 |
+
d(c) {
|
524 |
+
c && (h(t), h(e), h(i), h(a), h(r)), _ && _.d(c), u && u.d(), k && k.d(), ~s && p[s].d(c), F && F.d(c);
|
525 |
+
}
|
526 |
+
};
|
527 |
+
}
|
528 |
+
function Ne(n) {
|
529 |
+
let t, e = `translateX(${/*eta_level*/
|
530 |
+
(n[17] || 0) * 100 - 100}%)`;
|
531 |
+
return {
|
532 |
+
c() {
|
533 |
+
t = Z("div"), j(t, "class", "eta-bar svelte-1txqlrd"), B(t, "transform", e);
|
534 |
+
},
|
535 |
+
m(l, i) {
|
536 |
+
w(l, t, i);
|
537 |
+
},
|
538 |
+
p(l, i) {
|
539 |
+
i[0] & /*eta_level*/
|
540 |
+
131072 && e !== (e = `translateX(${/*eta_level*/
|
541 |
+
(l[17] || 0) * 100 - 100}%)`) && B(t, "transform", e);
|
542 |
+
},
|
543 |
+
d(l) {
|
544 |
+
l && h(t);
|
545 |
+
}
|
546 |
+
};
|
547 |
+
}
|
548 |
+
function Yt(n) {
|
549 |
+
let t;
|
550 |
+
return {
|
551 |
+
c() {
|
552 |
+
t = q("processing |");
|
553 |
+
},
|
554 |
+
m(e, l) {
|
555 |
+
w(e, t, l);
|
556 |
+
},
|
557 |
+
p: oe,
|
558 |
+
d(e) {
|
559 |
+
e && h(t);
|
560 |
+
}
|
561 |
+
};
|
562 |
+
}
|
563 |
+
function Gt(n) {
|
564 |
+
let t, e = (
|
565 |
+
/*queue_position*/
|
566 |
+
n[2] + 1 + ""
|
567 |
+
), l, i, s, o;
|
568 |
+
return {
|
569 |
+
c() {
|
570 |
+
t = q("queue: "), l = q(e), i = q("/"), s = q(
|
571 |
+
/*queue_size*/
|
572 |
+
n[3]
|
573 |
+
), o = q(" |");
|
574 |
+
},
|
575 |
+
m(a, r) {
|
576 |
+
w(a, t, r), w(a, l, r), w(a, i, r), w(a, s, r), w(a, o, r);
|
577 |
+
},
|
578 |
+
p(a, r) {
|
579 |
+
r[0] & /*queue_position*/
|
580 |
+
4 && e !== (e = /*queue_position*/
|
581 |
+
a[2] + 1 + "") && S(l, e), r[0] & /*queue_size*/
|
582 |
+
8 && S(
|
583 |
+
s,
|
584 |
+
/*queue_size*/
|
585 |
+
a[3]
|
586 |
+
);
|
587 |
+
},
|
588 |
+
d(a) {
|
589 |
+
a && (h(t), h(l), h(i), h(s), h(o));
|
590 |
+
}
|
591 |
+
};
|
592 |
+
}
|
593 |
+
function Ot(n) {
|
594 |
+
let t, e = le(
|
595 |
+
/*progress*/
|
596 |
+
n[7]
|
597 |
+
), l = [];
|
598 |
+
for (let i = 0; i < e.length; i += 1)
|
599 |
+
l[i] = Te(Se(n, e, i));
|
600 |
+
return {
|
601 |
+
c() {
|
602 |
+
for (let i = 0; i < l.length; i += 1)
|
603 |
+
l[i].c();
|
604 |
+
t = W();
|
605 |
+
},
|
606 |
+
m(i, s) {
|
607 |
+
for (let o = 0; o < l.length; o += 1)
|
608 |
+
l[o] && l[o].m(i, s);
|
609 |
+
w(i, t, s);
|
610 |
+
},
|
611 |
+
p(i, s) {
|
612 |
+
if (s[0] & /*progress*/
|
613 |
+
128) {
|
614 |
+
e = le(
|
615 |
+
/*progress*/
|
616 |
+
i[7]
|
617 |
+
);
|
618 |
+
let o;
|
619 |
+
for (o = 0; o < e.length; o += 1) {
|
620 |
+
const a = Se(i, e, o);
|
621 |
+
l[o] ? l[o].p(a, s) : (l[o] = Te(a), l[o].c(), l[o].m(t.parentNode, t));
|
622 |
+
}
|
623 |
+
for (; o < l.length; o += 1)
|
624 |
+
l[o].d(1);
|
625 |
+
l.length = e.length;
|
626 |
+
}
|
627 |
+
},
|
628 |
+
d(i) {
|
629 |
+
i && h(t), Ke(l, i);
|
630 |
+
}
|
631 |
+
};
|
632 |
+
}
|
633 |
+
function ze(n) {
|
634 |
+
let t, e = (
|
635 |
+
/*p*/
|
636 |
+
n[38].unit + ""
|
637 |
+
), l, i, s = " ", o;
|
638 |
+
function a(_, m) {
|
639 |
+
return (
|
640 |
+
/*p*/
|
641 |
+
_[38].length != null ? Ut : Rt
|
642 |
+
);
|
643 |
+
}
|
644 |
+
let r = a(n), f = r(n);
|
645 |
+
return {
|
646 |
+
c() {
|
647 |
+
f.c(), t = P(), l = q(e), i = q(" | "), o = q(s);
|
648 |
+
},
|
649 |
+
m(_, m) {
|
650 |
+
f.m(_, m), w(_, t, m), w(_, l, m), w(_, i, m), w(_, o, m);
|
651 |
+
},
|
652 |
+
p(_, m) {
|
653 |
+
r === (r = a(_)) && f ? f.p(_, m) : (f.d(1), f = r(_), f && (f.c(), f.m(t.parentNode, t))), m[0] & /*progress*/
|
654 |
+
128 && e !== (e = /*p*/
|
655 |
+
_[38].unit + "") && S(l, e);
|
656 |
+
},
|
657 |
+
d(_) {
|
658 |
+
_ && (h(t), h(l), h(i), h(o)), f.d(_);
|
659 |
+
}
|
660 |
+
};
|
661 |
+
}
|
662 |
+
function Rt(n) {
|
663 |
+
let t = G(
|
664 |
+
/*p*/
|
665 |
+
n[38].index || 0
|
666 |
+
) + "", e;
|
667 |
+
return {
|
668 |
+
c() {
|
669 |
+
e = q(t);
|
670 |
+
},
|
671 |
+
m(l, i) {
|
672 |
+
w(l, e, i);
|
673 |
+
},
|
674 |
+
p(l, i) {
|
675 |
+
i[0] & /*progress*/
|
676 |
+
128 && t !== (t = G(
|
677 |
+
/*p*/
|
678 |
+
l[38].index || 0
|
679 |
+
) + "") && S(e, t);
|
680 |
+
},
|
681 |
+
d(l) {
|
682 |
+
l && h(e);
|
683 |
+
}
|
684 |
+
};
|
685 |
+
}
|
686 |
+
function Ut(n) {
|
687 |
+
let t = G(
|
688 |
+
/*p*/
|
689 |
+
n[38].index || 0
|
690 |
+
) + "", e, l, i = G(
|
691 |
+
/*p*/
|
692 |
+
n[38].length
|
693 |
+
) + "", s;
|
694 |
+
return {
|
695 |
+
c() {
|
696 |
+
e = q(t), l = q("/"), s = q(i);
|
697 |
+
},
|
698 |
+
m(o, a) {
|
699 |
+
w(o, e, a), w(o, l, a), w(o, s, a);
|
700 |
+
},
|
701 |
+
p(o, a) {
|
702 |
+
a[0] & /*progress*/
|
703 |
+
128 && t !== (t = G(
|
704 |
+
/*p*/
|
705 |
+
o[38].index || 0
|
706 |
+
) + "") && S(e, t), a[0] & /*progress*/
|
707 |
+
128 && i !== (i = G(
|
708 |
+
/*p*/
|
709 |
+
o[38].length
|
710 |
+
) + "") && S(s, i);
|
711 |
+
},
|
712 |
+
d(o) {
|
713 |
+
o && (h(e), h(l), h(s));
|
714 |
+
}
|
715 |
+
};
|
716 |
+
}
|
717 |
+
function Te(n) {
|
718 |
+
let t, e = (
|
719 |
+
/*p*/
|
720 |
+
n[38].index != null && ze(n)
|
721 |
+
);
|
722 |
+
return {
|
723 |
+
c() {
|
724 |
+
e && e.c(), t = W();
|
725 |
+
},
|
726 |
+
m(l, i) {
|
727 |
+
e && e.m(l, i), w(l, t, i);
|
728 |
+
},
|
729 |
+
p(l, i) {
|
730 |
+
/*p*/
|
731 |
+
l[38].index != null ? e ? e.p(l, i) : (e = ze(l), e.c(), e.m(t.parentNode, t)) : e && (e.d(1), e = null);
|
732 |
+
},
|
733 |
+
d(l) {
|
734 |
+
l && h(t), e && e.d(l);
|
735 |
+
}
|
736 |
+
};
|
737 |
+
}
|
738 |
+
function je(n) {
|
739 |
+
let t, e = (
|
740 |
+
/*eta*/
|
741 |
+
n[0] ? `/${/*formatted_eta*/
|
742 |
+
n[19]}` : ""
|
743 |
+
), l, i;
|
744 |
+
return {
|
745 |
+
c() {
|
746 |
+
t = q(
|
747 |
+
/*formatted_timer*/
|
748 |
+
n[20]
|
749 |
+
), l = q(e), i = q("s");
|
750 |
+
},
|
751 |
+
m(s, o) {
|
752 |
+
w(s, t, o), w(s, l, o), w(s, i, o);
|
753 |
+
},
|
754 |
+
p(s, o) {
|
755 |
+
o[0] & /*formatted_timer*/
|
756 |
+
1048576 && S(
|
757 |
+
t,
|
758 |
+
/*formatted_timer*/
|
759 |
+
s[20]
|
760 |
+
), o[0] & /*eta, formatted_eta*/
|
761 |
+
524289 && e !== (e = /*eta*/
|
762 |
+
s[0] ? `/${/*formatted_eta*/
|
763 |
+
s[19]}` : "") && S(l, e);
|
764 |
+
},
|
765 |
+
d(s) {
|
766 |
+
s && (h(t), h(l), h(i));
|
767 |
+
}
|
768 |
+
};
|
769 |
+
}
|
770 |
+
function Wt(n) {
|
771 |
+
let t, e;
|
772 |
+
return t = new Mt({
|
773 |
+
props: { margin: (
|
774 |
+
/*variant*/
|
775 |
+
n[8] === "default"
|
776 |
+
) }
|
777 |
+
}), {
|
778 |
+
c() {
|
779 |
+
St(t.$$.fragment);
|
780 |
+
},
|
781 |
+
m(l, i) {
|
782 |
+
Zt(t, l, i), e = !0;
|
783 |
+
},
|
784 |
+
p(l, i) {
|
785 |
+
const s = {};
|
786 |
+
i[0] & /*variant*/
|
787 |
+
256 && (s.margin = /*variant*/
|
788 |
+
l[8] === "default"), t.$set(s);
|
789 |
+
},
|
790 |
+
i(l) {
|
791 |
+
e || (R(t.$$.fragment, l), e = !0);
|
792 |
+
},
|
793 |
+
o(l) {
|
794 |
+
U(t.$$.fragment, l), e = !1;
|
795 |
+
},
|
796 |
+
d(l) {
|
797 |
+
zt(t, l);
|
798 |
+
}
|
799 |
+
};
|
800 |
+
}
|
801 |
+
function Jt(n) {
|
802 |
+
let t, e, l, i, s, o = `${/*last_progress_level*/
|
803 |
+
n[15] * 100}%`, a = (
|
804 |
+
/*progress*/
|
805 |
+
n[7] != null && Pe(n)
|
806 |
+
);
|
807 |
+
return {
|
808 |
+
c() {
|
809 |
+
t = Z("div"), e = Z("div"), a && a.c(), l = P(), i = Z("div"), s = Z("div"), j(e, "class", "progress-level-inner svelte-1txqlrd"), j(s, "class", "progress-bar svelte-1txqlrd"), B(s, "width", o), j(i, "class", "progress-bar-wrap svelte-1txqlrd"), j(t, "class", "progress-level svelte-1txqlrd");
|
810 |
+
},
|
811 |
+
m(r, f) {
|
812 |
+
w(r, t, f), H(t, e), a && a.m(e, null), H(t, l), H(t, i), H(i, s), n[30](s);
|
813 |
+
},
|
814 |
+
p(r, f) {
|
815 |
+
/*progress*/
|
816 |
+
r[7] != null ? a ? a.p(r, f) : (a = Pe(r), a.c(), a.m(e, null)) : a && (a.d(1), a = null), f[0] & /*last_progress_level*/
|
817 |
+
32768 && o !== (o = `${/*last_progress_level*/
|
818 |
+
r[15] * 100}%`) && B(s, "width", o);
|
819 |
+
},
|
820 |
+
i: oe,
|
821 |
+
o: oe,
|
822 |
+
d(r) {
|
823 |
+
r && h(t), a && a.d(), n[30](null);
|
824 |
+
}
|
825 |
+
};
|
826 |
+
}
|
827 |
+
function Pe(n) {
|
828 |
+
let t, e = le(
|
829 |
+
/*progress*/
|
830 |
+
n[7]
|
831 |
+
), l = [];
|
832 |
+
for (let i = 0; i < e.length; i += 1)
|
833 |
+
l[i] = Ae(Ve(n, e, i));
|
834 |
+
return {
|
835 |
+
c() {
|
836 |
+
for (let i = 0; i < l.length; i += 1)
|
837 |
+
l[i].c();
|
838 |
+
t = W();
|
839 |
+
},
|
840 |
+
m(i, s) {
|
841 |
+
for (let o = 0; o < l.length; o += 1)
|
842 |
+
l[o] && l[o].m(i, s);
|
843 |
+
w(i, t, s);
|
844 |
+
},
|
845 |
+
p(i, s) {
|
846 |
+
if (s[0] & /*progress_level, progress*/
|
847 |
+
16512) {
|
848 |
+
e = le(
|
849 |
+
/*progress*/
|
850 |
+
i[7]
|
851 |
+
);
|
852 |
+
let o;
|
853 |
+
for (o = 0; o < e.length; o += 1) {
|
854 |
+
const a = Ve(i, e, o);
|
855 |
+
l[o] ? l[o].p(a, s) : (l[o] = Ae(a), l[o].c(), l[o].m(t.parentNode, t));
|
856 |
+
}
|
857 |
+
for (; o < l.length; o += 1)
|
858 |
+
l[o].d(1);
|
859 |
+
l.length = e.length;
|
860 |
+
}
|
861 |
+
},
|
862 |
+
d(i) {
|
863 |
+
i && h(t), Ke(l, i);
|
864 |
+
}
|
865 |
+
};
|
866 |
+
}
|
867 |
+
function Ze(n) {
|
868 |
+
let t, e, l, i, s = (
|
869 |
+
/*i*/
|
870 |
+
n[40] !== 0 && Kt()
|
871 |
+
), o = (
|
872 |
+
/*p*/
|
873 |
+
n[38].desc != null && De(n)
|
874 |
+
), a = (
|
875 |
+
/*p*/
|
876 |
+
n[38].desc != null && /*progress_level*/
|
877 |
+
n[14] && /*progress_level*/
|
878 |
+
n[14][
|
879 |
+
/*i*/
|
880 |
+
n[40]
|
881 |
+
] != null && Ee()
|
882 |
+
), r = (
|
883 |
+
/*progress_level*/
|
884 |
+
n[14] != null && Be(n)
|
885 |
+
);
|
886 |
+
return {
|
887 |
+
c() {
|
888 |
+
s && s.c(), t = P(), o && o.c(), e = P(), a && a.c(), l = P(), r && r.c(), i = W();
|
889 |
+
},
|
890 |
+
m(f, _) {
|
891 |
+
s && s.m(f, _), w(f, t, _), o && o.m(f, _), w(f, e, _), a && a.m(f, _), w(f, l, _), r && r.m(f, _), w(f, i, _);
|
892 |
+
},
|
893 |
+
p(f, _) {
|
894 |
+
/*p*/
|
895 |
+
f[38].desc != null ? o ? o.p(f, _) : (o = De(f), o.c(), o.m(e.parentNode, e)) : o && (o.d(1), o = null), /*p*/
|
896 |
+
f[38].desc != null && /*progress_level*/
|
897 |
+
f[14] && /*progress_level*/
|
898 |
+
f[14][
|
899 |
+
/*i*/
|
900 |
+
f[40]
|
901 |
+
] != null ? a || (a = Ee(), a.c(), a.m(l.parentNode, l)) : a && (a.d(1), a = null), /*progress_level*/
|
902 |
+
f[14] != null ? r ? r.p(f, _) : (r = Be(f), r.c(), r.m(i.parentNode, i)) : r && (r.d(1), r = null);
|
903 |
+
},
|
904 |
+
d(f) {
|
905 |
+
f && (h(t), h(e), h(l), h(i)), s && s.d(f), o && o.d(f), a && a.d(f), r && r.d(f);
|
906 |
+
}
|
907 |
+
};
|
908 |
+
}
|
909 |
+
function Kt(n) {
|
910 |
+
let t;
|
911 |
+
return {
|
912 |
+
c() {
|
913 |
+
t = q(" /");
|
914 |
+
},
|
915 |
+
m(e, l) {
|
916 |
+
w(e, t, l);
|
917 |
+
},
|
918 |
+
d(e) {
|
919 |
+
e && h(t);
|
920 |
+
}
|
921 |
+
};
|
922 |
+
}
|
923 |
+
function De(n) {
|
924 |
+
let t = (
|
925 |
+
/*p*/
|
926 |
+
n[38].desc + ""
|
927 |
+
), e;
|
928 |
+
return {
|
929 |
+
c() {
|
930 |
+
e = q(t);
|
931 |
+
},
|
932 |
+
m(l, i) {
|
933 |
+
w(l, e, i);
|
934 |
+
},
|
935 |
+
p(l, i) {
|
936 |
+
i[0] & /*progress*/
|
937 |
+
128 && t !== (t = /*p*/
|
938 |
+
l[38].desc + "") && S(e, t);
|
939 |
+
},
|
940 |
+
d(l) {
|
941 |
+
l && h(e);
|
942 |
+
}
|
943 |
+
};
|
944 |
+
}
|
945 |
+
function Ee(n) {
|
946 |
+
let t;
|
947 |
+
return {
|
948 |
+
c() {
|
949 |
+
t = q("-");
|
950 |
+
},
|
951 |
+
m(e, l) {
|
952 |
+
w(e, t, l);
|
953 |
+
},
|
954 |
+
d(e) {
|
955 |
+
e && h(t);
|
956 |
+
}
|
957 |
+
};
|
958 |
+
}
|
959 |
+
function Be(n) {
|
960 |
+
let t = (100 * /*progress_level*/
|
961 |
+
(n[14][
|
962 |
+
/*i*/
|
963 |
+
n[40]
|
964 |
+
] || 0)).toFixed(1) + "", e, l;
|
965 |
+
return {
|
966 |
+
c() {
|
967 |
+
e = q(t), l = q("%");
|
968 |
+
},
|
969 |
+
m(i, s) {
|
970 |
+
w(i, e, s), w(i, l, s);
|
971 |
+
},
|
972 |
+
p(i, s) {
|
973 |
+
s[0] & /*progress_level*/
|
974 |
+
16384 && t !== (t = (100 * /*progress_level*/
|
975 |
+
(i[14][
|
976 |
+
/*i*/
|
977 |
+
i[40]
|
978 |
+
] || 0)).toFixed(1) + "") && S(e, t);
|
979 |
+
},
|
980 |
+
d(i) {
|
981 |
+
i && (h(e), h(l));
|
982 |
+
}
|
983 |
+
};
|
984 |
+
}
|
985 |
+
function Ae(n) {
|
986 |
+
let t, e = (
|
987 |
+
/*p*/
|
988 |
+
(n[38].desc != null || /*progress_level*/
|
989 |
+
n[14] && /*progress_level*/
|
990 |
+
n[14][
|
991 |
+
/*i*/
|
992 |
+
n[40]
|
993 |
+
] != null) && Ze(n)
|
994 |
+
);
|
995 |
+
return {
|
996 |
+
c() {
|
997 |
+
e && e.c(), t = W();
|
998 |
+
},
|
999 |
+
m(l, i) {
|
1000 |
+
e && e.m(l, i), w(l, t, i);
|
1001 |
+
},
|
1002 |
+
p(l, i) {
|
1003 |
+
/*p*/
|
1004 |
+
l[38].desc != null || /*progress_level*/
|
1005 |
+
l[14] && /*progress_level*/
|
1006 |
+
l[14][
|
1007 |
+
/*i*/
|
1008 |
+
l[40]
|
1009 |
+
] != null ? e ? e.p(l, i) : (e = Ze(l), e.c(), e.m(t.parentNode, t)) : e && (e.d(1), e = null);
|
1010 |
+
},
|
1011 |
+
d(l) {
|
1012 |
+
l && h(t), e && e.d(l);
|
1013 |
+
}
|
1014 |
+
};
|
1015 |
+
}
|
1016 |
+
function Ie(n) {
|
1017 |
+
let t, e;
|
1018 |
+
return {
|
1019 |
+
c() {
|
1020 |
+
t = Z("p"), e = q(
|
1021 |
+
/*loading_text*/
|
1022 |
+
n[9]
|
1023 |
+
), j(t, "class", "loading svelte-1txqlrd");
|
1024 |
+
},
|
1025 |
+
m(l, i) {
|
1026 |
+
w(l, t, i), H(t, e);
|
1027 |
+
},
|
1028 |
+
p(l, i) {
|
1029 |
+
i[0] & /*loading_text*/
|
1030 |
+
512 && S(
|
1031 |
+
e,
|
1032 |
+
/*loading_text*/
|
1033 |
+
l[9]
|
1034 |
+
);
|
1035 |
+
},
|
1036 |
+
d(l) {
|
1037 |
+
l && h(t);
|
1038 |
+
}
|
1039 |
+
};
|
1040 |
+
}
|
1041 |
+
function Qt(n) {
|
1042 |
+
let t, e, l, i, s;
|
1043 |
+
const o = [Xt, Ht], a = [];
|
1044 |
+
function r(f, _) {
|
1045 |
+
return (
|
1046 |
+
/*status*/
|
1047 |
+
f[4] === "pending" ? 0 : (
|
1048 |
+
/*status*/
|
1049 |
+
f[4] === "error" ? 1 : -1
|
1050 |
+
)
|
1051 |
+
);
|
1052 |
+
}
|
1053 |
+
return ~(e = r(n)) && (l = a[e] = o[e](n)), {
|
1054 |
+
c() {
|
1055 |
+
t = Z("div"), l && l.c(), j(t, "class", i = "wrap " + /*variant*/
|
1056 |
+
n[8] + " " + /*show_progress*/
|
1057 |
+
n[6] + " svelte-1txqlrd"), V(t, "hide", !/*status*/
|
1058 |
+
n[4] || /*status*/
|
1059 |
+
n[4] === "complete" || /*show_progress*/
|
1060 |
+
n[6] === "hidden"), V(
|
1061 |
+
t,
|
1062 |
+
"translucent",
|
1063 |
+
/*variant*/
|
1064 |
+
n[8] === "center" && /*status*/
|
1065 |
+
(n[4] === "pending" || /*status*/
|
1066 |
+
n[4] === "error") || /*translucent*/
|
1067 |
+
n[11] || /*show_progress*/
|
1068 |
+
n[6] === "minimal"
|
1069 |
+
), V(
|
1070 |
+
t,
|
1071 |
+
"generating",
|
1072 |
+
/*status*/
|
1073 |
+
n[4] === "generating"
|
1074 |
+
), V(
|
1075 |
+
t,
|
1076 |
+
"border",
|
1077 |
+
/*border*/
|
1078 |
+
n[12]
|
1079 |
+
), B(
|
1080 |
+
t,
|
1081 |
+
"position",
|
1082 |
+
/*absolute*/
|
1083 |
+
n[10] ? "absolute" : "static"
|
1084 |
+
), B(
|
1085 |
+
t,
|
1086 |
+
"padding",
|
1087 |
+
/*absolute*/
|
1088 |
+
n[10] ? "0" : "var(--size-8) 0"
|
1089 |
+
);
|
1090 |
+
},
|
1091 |
+
m(f, _) {
|
1092 |
+
w(f, t, _), ~e && a[e].m(t, null), n[31](t), s = !0;
|
1093 |
+
},
|
1094 |
+
p(f, _) {
|
1095 |
+
let m = e;
|
1096 |
+
e = r(f), e === m ? ~e && a[e].p(f, _) : (l && (Qe(), U(a[m], 1, 1, () => {
|
1097 |
+
a[m] = null;
|
1098 |
+
}), Je()), ~e ? (l = a[e], l ? l.p(f, _) : (l = a[e] = o[e](f), l.c()), R(l, 1), l.m(t, null)) : l = null), (!s || _[0] & /*variant, show_progress*/
|
1099 |
+
320 && i !== (i = "wrap " + /*variant*/
|
1100 |
+
f[8] + " " + /*show_progress*/
|
1101 |
+
f[6] + " svelte-1txqlrd")) && j(t, "class", i), (!s || _[0] & /*variant, show_progress, status, show_progress*/
|
1102 |
+
336) && V(t, "hide", !/*status*/
|
1103 |
+
f[4] || /*status*/
|
1104 |
+
f[4] === "complete" || /*show_progress*/
|
1105 |
+
f[6] === "hidden"), (!s || _[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
|
1106 |
+
2384) && V(
|
1107 |
+
t,
|
1108 |
+
"translucent",
|
1109 |
+
/*variant*/
|
1110 |
+
f[8] === "center" && /*status*/
|
1111 |
+
(f[4] === "pending" || /*status*/
|
1112 |
+
f[4] === "error") || /*translucent*/
|
1113 |
+
f[11] || /*show_progress*/
|
1114 |
+
f[6] === "minimal"
|
1115 |
+
), (!s || _[0] & /*variant, show_progress, status*/
|
1116 |
+
336) && V(
|
1117 |
+
t,
|
1118 |
+
"generating",
|
1119 |
+
/*status*/
|
1120 |
+
f[4] === "generating"
|
1121 |
+
), (!s || _[0] & /*variant, show_progress, border*/
|
1122 |
+
4416) && V(
|
1123 |
+
t,
|
1124 |
+
"border",
|
1125 |
+
/*border*/
|
1126 |
+
f[12]
|
1127 |
+
), _[0] & /*absolute*/
|
1128 |
+
1024 && B(
|
1129 |
+
t,
|
1130 |
+
"position",
|
1131 |
+
/*absolute*/
|
1132 |
+
f[10] ? "absolute" : "static"
|
1133 |
+
), _[0] & /*absolute*/
|
1134 |
+
1024 && B(
|
1135 |
+
t,
|
1136 |
+
"padding",
|
1137 |
+
/*absolute*/
|
1138 |
+
f[10] ? "0" : "var(--size-8) 0"
|
1139 |
+
);
|
1140 |
+
},
|
1141 |
+
i(f) {
|
1142 |
+
s || (R(l), s = !0);
|
1143 |
+
},
|
1144 |
+
o(f) {
|
1145 |
+
U(l), s = !1;
|
1146 |
+
},
|
1147 |
+
d(f) {
|
1148 |
+
f && h(t), ~e && a[e].d(), n[31](null);
|
1149 |
+
}
|
1150 |
+
};
|
1151 |
+
}
|
1152 |
+
let ee = [], fe = !1;
|
1153 |
+
async function xt(n, t = !0) {
|
1154 |
+
if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) {
|
1155 |
+
if (ee.push(n), !fe)
|
1156 |
+
fe = !0;
|
1157 |
+
else
|
1158 |
+
return;
|
1159 |
+
await Bt(), requestAnimationFrame(() => {
|
1160 |
+
let e = [0, 0];
|
1161 |
+
for (let l = 0; l < ee.length; l++) {
|
1162 |
+
const s = ee[l].getBoundingClientRect();
|
1163 |
+
(l === 0 || s.top + window.scrollY <= e[0]) && (e[0] = s.top + window.scrollY, e[1] = l);
|
1164 |
+
}
|
1165 |
+
window.scrollTo({ top: e[0] - 20, behavior: "smooth" }), fe = !1, ee = [];
|
1166 |
+
});
|
1167 |
+
}
|
1168 |
+
}
|
1169 |
+
function $t(n, t, e) {
|
1170 |
+
let l, { $$slots: i = {}, $$scope: s } = t, { i18n: o } = t, { eta: a = null } = t, { queue: r = !1 } = t, { queue_position: f } = t, { queue_size: _ } = t, { status: m } = t, { scroll_to_output: b = !1 } = t, { timer: u = !0 } = t, { show_progress: k = "full" } = t, { message: C = null } = t, { progress: p = null } = t, { variant: L = "default" } = t, { loading_text: F = "Loading..." } = t, { absolute: c = !0 } = t, { translucent: y = !1 } = t, { border: g = !1 } = t, { autoscroll: ne } = t, J, K = !1, x = 0, A = 0, ie = null, de = 0, I = null, Q, D = null, me = !0;
|
1171 |
+
const et = () => {
|
1172 |
+
e(25, x = performance.now()), e(26, A = 0), K = !0, be();
|
1173 |
+
};
|
1174 |
+
function be() {
|
1175 |
+
requestAnimationFrame(() => {
|
1176 |
+
e(26, A = (performance.now() - x) / 1e3), K && be();
|
1177 |
+
});
|
1178 |
+
}
|
1179 |
+
function ge() {
|
1180 |
+
e(26, A = 0), K && (K = !1);
|
1181 |
+
}
|
1182 |
+
At(() => {
|
1183 |
+
K && ge();
|
1184 |
+
});
|
1185 |
+
let he = null;
|
1186 |
+
function tt(d) {
|
1187 |
+
Ce[d ? "unshift" : "push"](() => {
|
1188 |
+
D = d, e(16, D), e(7, p), e(14, I), e(15, Q);
|
1189 |
+
});
|
1190 |
+
}
|
1191 |
+
function lt(d) {
|
1192 |
+
Ce[d ? "unshift" : "push"](() => {
|
1193 |
+
J = d, e(13, J);
|
1194 |
+
});
|
1195 |
+
}
|
1196 |
+
return n.$$set = (d) => {
|
1197 |
+
"i18n" in d && e(1, o = d.i18n), "eta" in d && e(0, a = d.eta), "queue" in d && e(21, r = d.queue), "queue_position" in d && e(2, f = d.queue_position), "queue_size" in d && e(3, _ = d.queue_size), "status" in d && e(4, m = d.status), "scroll_to_output" in d && e(22, b = d.scroll_to_output), "timer" in d && e(5, u = d.timer), "show_progress" in d && e(6, k = d.show_progress), "message" in d && e(23, C = d.message), "progress" in d && e(7, p = d.progress), "variant" in d && e(8, L = d.variant), "loading_text" in d && e(9, F = d.loading_text), "absolute" in d && e(10, c = d.absolute), "translucent" in d && e(11, y = d.translucent), "border" in d && e(12, g = d.border), "autoscroll" in d && e(24, ne = d.autoscroll), "$$scope" in d && e(28, s = d.$$scope);
|
1198 |
+
}, n.$$.update = () => {
|
1199 |
+
n.$$.dirty[0] & /*eta, old_eta, queue, timer_start*/
|
1200 |
+
169869313 && (a === null ? e(0, a = ie) : r && e(0, a = (performance.now() - x) / 1e3 + a), a != null && (e(19, he = a.toFixed(1)), e(27, ie = a))), n.$$.dirty[0] & /*eta, timer_diff*/
|
1201 |
+
67108865 && e(17, de = a === null || a <= 0 || !A ? null : Math.min(A / a, 1)), n.$$.dirty[0] & /*progress*/
|
1202 |
+
128 && p != null && e(18, me = !1), n.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
|
1203 |
+
114816 && (p != null ? e(14, I = p.map((d) => {
|
1204 |
+
if (d.index != null && d.length != null)
|
1205 |
+
return d.index / d.length;
|
1206 |
+
if (d.progress != null)
|
1207 |
+
return d.progress;
|
1208 |
+
})) : e(14, I = null), I ? (e(15, Q = I[I.length - 1]), D && (Q === 0 ? e(16, D.style.transition = "0", D) : e(16, D.style.transition = "150ms", D))) : e(15, Q = void 0)), n.$$.dirty[0] & /*status*/
|
1209 |
+
16 && (m === "pending" ? et() : ge()), n.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
|
1210 |
+
20979728 && J && b && (m === "pending" || m === "complete") && xt(J, ne), n.$$.dirty[0] & /*status, message*/
|
1211 |
+
8388624, n.$$.dirty[0] & /*timer_diff*/
|
1212 |
+
67108864 && e(20, l = A.toFixed(1));
|
1213 |
+
}, [
|
1214 |
+
a,
|
1215 |
+
o,
|
1216 |
+
f,
|
1217 |
+
_,
|
1218 |
+
m,
|
1219 |
+
u,
|
1220 |
+
k,
|
1221 |
+
p,
|
1222 |
+
L,
|
1223 |
+
F,
|
1224 |
+
c,
|
1225 |
+
y,
|
1226 |
+
g,
|
1227 |
+
J,
|
1228 |
+
I,
|
1229 |
+
Q,
|
1230 |
+
D,
|
1231 |
+
de,
|
1232 |
+
me,
|
1233 |
+
he,
|
1234 |
+
l,
|
1235 |
+
r,
|
1236 |
+
b,
|
1237 |
+
C,
|
1238 |
+
ne,
|
1239 |
+
x,
|
1240 |
+
A,
|
1241 |
+
ie,
|
1242 |
+
s,
|
1243 |
+
i,
|
1244 |
+
tt,
|
1245 |
+
lt
|
1246 |
+
];
|
1247 |
+
}
|
1248 |
+
class el extends Vt {
|
1249 |
+
constructor(t) {
|
1250 |
+
super(), Pt(
|
1251 |
+
this,
|
1252 |
+
t,
|
1253 |
+
$t,
|
1254 |
+
Qt,
|
1255 |
+
Dt,
|
1256 |
+
{
|
1257 |
+
i18n: 1,
|
1258 |
+
eta: 0,
|
1259 |
+
queue: 21,
|
1260 |
+
queue_position: 2,
|
1261 |
+
queue_size: 3,
|
1262 |
+
status: 4,
|
1263 |
+
scroll_to_output: 22,
|
1264 |
+
timer: 5,
|
1265 |
+
show_progress: 6,
|
1266 |
+
message: 23,
|
1267 |
+
progress: 7,
|
1268 |
+
variant: 8,
|
1269 |
+
loading_text: 9,
|
1270 |
+
absolute: 10,
|
1271 |
+
translucent: 11,
|
1272 |
+
border: 12,
|
1273 |
+
autoscroll: 24
|
1274 |
+
},
|
1275 |
+
null,
|
1276 |
+
[-1, -1]
|
1277 |
+
);
|
1278 |
+
}
|
1279 |
+
}
|
1280 |
+
const {
|
1281 |
+
SvelteComponent: tl,
|
1282 |
+
assign: ll,
|
1283 |
+
create_slot: nl,
|
1284 |
+
detach: il,
|
1285 |
+
element: fl,
|
1286 |
+
get_all_dirty_from_scope: sl,
|
1287 |
+
get_slot_changes: ol,
|
1288 |
+
get_spread_update: al,
|
1289 |
+
init: rl,
|
1290 |
+
insert: _l,
|
1291 |
+
safe_not_equal: ul,
|
1292 |
+
set_dynamic_element_data: He,
|
1293 |
+
set_style: M,
|
1294 |
+
toggle_class: E,
|
1295 |
+
transition_in: xe,
|
1296 |
+
transition_out: $e,
|
1297 |
+
update_slot_base: cl
|
1298 |
+
} = window.__gradio__svelte__internal;
|
1299 |
+
function dl(n) {
|
1300 |
+
let t, e, l;
|
1301 |
+
const i = (
|
1302 |
+
/*#slots*/
|
1303 |
+
n[17].default
|
1304 |
+
), s = nl(
|
1305 |
+
i,
|
1306 |
+
n,
|
1307 |
+
/*$$scope*/
|
1308 |
+
n[16],
|
1309 |
+
null
|
1310 |
+
);
|
1311 |
+
let o = [
|
1312 |
+
{ "data-testid": (
|
1313 |
+
/*test_id*/
|
1314 |
+
n[7]
|
1315 |
+
) },
|
1316 |
+
{ id: (
|
1317 |
+
/*elem_id*/
|
1318 |
+
n[2]
|
1319 |
+
) },
|
1320 |
+
{
|
1321 |
+
class: e = "block " + /*elem_classes*/
|
1322 |
+
n[3].join(" ") + " svelte-1t38q2d"
|
1323 |
+
}
|
1324 |
+
], a = {};
|
1325 |
+
for (let r = 0; r < o.length; r += 1)
|
1326 |
+
a = ll(a, o[r]);
|
1327 |
+
return {
|
1328 |
+
c() {
|
1329 |
+
t = fl(
|
1330 |
+
/*tag*/
|
1331 |
+
n[14]
|
1332 |
+
), s && s.c(), He(
|
1333 |
+
/*tag*/
|
1334 |
+
n[14]
|
1335 |
+
)(t, a), E(
|
1336 |
+
t,
|
1337 |
+
"hidden",
|
1338 |
+
/*visible*/
|
1339 |
+
n[10] === !1
|
1340 |
+
), E(
|
1341 |
+
t,
|
1342 |
+
"padded",
|
1343 |
+
/*padding*/
|
1344 |
+
n[6]
|
1345 |
+
), E(
|
1346 |
+
t,
|
1347 |
+
"border_focus",
|
1348 |
+
/*border_mode*/
|
1349 |
+
n[5] === "focus"
|
1350 |
+
), E(t, "hide-container", !/*explicit_call*/
|
1351 |
+
n[8] && !/*container*/
|
1352 |
+
n[9]), M(t, "height", typeof /*height*/
|
1353 |
+
n[0] == "number" ? (
|
1354 |
+
/*height*/
|
1355 |
+
n[0] + "px"
|
1356 |
+
) : void 0), M(t, "width", typeof /*width*/
|
1357 |
+
n[1] == "number" ? `calc(min(${/*width*/
|
1358 |
+
n[1]}px, 100%))` : void 0), M(
|
1359 |
+
t,
|
1360 |
+
"border-style",
|
1361 |
+
/*variant*/
|
1362 |
+
n[4]
|
1363 |
+
), M(
|
1364 |
+
t,
|
1365 |
+
"overflow",
|
1366 |
+
/*allow_overflow*/
|
1367 |
+
n[11] ? "visible" : "hidden"
|
1368 |
+
), M(
|
1369 |
+
t,
|
1370 |
+
"flex-grow",
|
1371 |
+
/*scale*/
|
1372 |
+
n[12]
|
1373 |
+
), M(t, "min-width", `calc(min(${/*min_width*/
|
1374 |
+
n[13]}px, 100%))`), M(t, "border-width", "var(--block-border-width)");
|
1375 |
+
},
|
1376 |
+
m(r, f) {
|
1377 |
+
_l(r, t, f), s && s.m(t, null), l = !0;
|
1378 |
+
},
|
1379 |
+
p(r, f) {
|
1380 |
+
s && s.p && (!l || f & /*$$scope*/
|
1381 |
+
65536) && cl(
|
1382 |
+
s,
|
1383 |
+
i,
|
1384 |
+
r,
|
1385 |
+
/*$$scope*/
|
1386 |
+
r[16],
|
1387 |
+
l ? ol(
|
1388 |
+
i,
|
1389 |
+
/*$$scope*/
|
1390 |
+
r[16],
|
1391 |
+
f,
|
1392 |
+
null
|
1393 |
+
) : sl(
|
1394 |
+
/*$$scope*/
|
1395 |
+
r[16]
|
1396 |
+
),
|
1397 |
+
null
|
1398 |
+
), He(
|
1399 |
+
/*tag*/
|
1400 |
+
r[14]
|
1401 |
+
)(t, a = al(o, [
|
1402 |
+
(!l || f & /*test_id*/
|
1403 |
+
128) && { "data-testid": (
|
1404 |
+
/*test_id*/
|
1405 |
+
r[7]
|
1406 |
+
) },
|
1407 |
+
(!l || f & /*elem_id*/
|
1408 |
+
4) && { id: (
|
1409 |
+
/*elem_id*/
|
1410 |
+
r[2]
|
1411 |
+
) },
|
1412 |
+
(!l || f & /*elem_classes*/
|
1413 |
+
8 && e !== (e = "block " + /*elem_classes*/
|
1414 |
+
r[3].join(" ") + " svelte-1t38q2d")) && { class: e }
|
1415 |
+
])), E(
|
1416 |
+
t,
|
1417 |
+
"hidden",
|
1418 |
+
/*visible*/
|
1419 |
+
r[10] === !1
|
1420 |
+
), E(
|
1421 |
+
t,
|
1422 |
+
"padded",
|
1423 |
+
/*padding*/
|
1424 |
+
r[6]
|
1425 |
+
), E(
|
1426 |
+
t,
|
1427 |
+
"border_focus",
|
1428 |
+
/*border_mode*/
|
1429 |
+
r[5] === "focus"
|
1430 |
+
), E(t, "hide-container", !/*explicit_call*/
|
1431 |
+
r[8] && !/*container*/
|
1432 |
+
r[9]), f & /*height*/
|
1433 |
+
1 && M(t, "height", typeof /*height*/
|
1434 |
+
r[0] == "number" ? (
|
1435 |
+
/*height*/
|
1436 |
+
r[0] + "px"
|
1437 |
+
) : void 0), f & /*width*/
|
1438 |
+
2 && M(t, "width", typeof /*width*/
|
1439 |
+
r[1] == "number" ? `calc(min(${/*width*/
|
1440 |
+
r[1]}px, 100%))` : void 0), f & /*variant*/
|
1441 |
+
16 && M(
|
1442 |
+
t,
|
1443 |
+
"border-style",
|
1444 |
+
/*variant*/
|
1445 |
+
r[4]
|
1446 |
+
), f & /*allow_overflow*/
|
1447 |
+
2048 && M(
|
1448 |
+
t,
|
1449 |
+
"overflow",
|
1450 |
+
/*allow_overflow*/
|
1451 |
+
r[11] ? "visible" : "hidden"
|
1452 |
+
), f & /*scale*/
|
1453 |
+
4096 && M(
|
1454 |
+
t,
|
1455 |
+
"flex-grow",
|
1456 |
+
/*scale*/
|
1457 |
+
r[12]
|
1458 |
+
), f & /*min_width*/
|
1459 |
+
8192 && M(t, "min-width", `calc(min(${/*min_width*/
|
1460 |
+
r[13]}px, 100%))`);
|
1461 |
+
},
|
1462 |
+
i(r) {
|
1463 |
+
l || (xe(s, r), l = !0);
|
1464 |
+
},
|
1465 |
+
o(r) {
|
1466 |
+
$e(s, r), l = !1;
|
1467 |
+
},
|
1468 |
+
d(r) {
|
1469 |
+
r && il(t), s && s.d(r);
|
1470 |
+
}
|
1471 |
+
};
|
1472 |
+
}
|
1473 |
+
function ml(n) {
|
1474 |
+
let t, e = (
|
1475 |
+
/*tag*/
|
1476 |
+
n[14] && dl(n)
|
1477 |
+
);
|
1478 |
+
return {
|
1479 |
+
c() {
|
1480 |
+
e && e.c();
|
1481 |
+
},
|
1482 |
+
m(l, i) {
|
1483 |
+
e && e.m(l, i), t = !0;
|
1484 |
+
},
|
1485 |
+
p(l, [i]) {
|
1486 |
+
/*tag*/
|
1487 |
+
l[14] && e.p(l, i);
|
1488 |
+
},
|
1489 |
+
i(l) {
|
1490 |
+
t || (xe(e, l), t = !0);
|
1491 |
+
},
|
1492 |
+
o(l) {
|
1493 |
+
$e(e, l), t = !1;
|
1494 |
+
},
|
1495 |
+
d(l) {
|
1496 |
+
e && e.d(l);
|
1497 |
+
}
|
1498 |
+
};
|
1499 |
+
}
|
1500 |
+
function bl(n, t, e) {
|
1501 |
+
let { $$slots: l = {}, $$scope: i } = t, { height: s = void 0 } = t, { width: o = void 0 } = t, { elem_id: a = "" } = t, { elem_classes: r = [] } = t, { variant: f = "solid" } = t, { border_mode: _ = "base" } = t, { padding: m = !0 } = t, { type: b = "normal" } = t, { test_id: u = void 0 } = t, { explicit_call: k = !1 } = t, { container: C = !0 } = t, { visible: p = !0 } = t, { allow_overflow: L = !0 } = t, { scale: F = null } = t, { min_width: c = 0 } = t, y = b === "fieldset" ? "fieldset" : "div";
|
1502 |
+
return n.$$set = (g) => {
|
1503 |
+
"height" in g && e(0, s = g.height), "width" in g && e(1, o = g.width), "elem_id" in g && e(2, a = g.elem_id), "elem_classes" in g && e(3, r = g.elem_classes), "variant" in g && e(4, f = g.variant), "border_mode" in g && e(5, _ = g.border_mode), "padding" in g && e(6, m = g.padding), "type" in g && e(15, b = g.type), "test_id" in g && e(7, u = g.test_id), "explicit_call" in g && e(8, k = g.explicit_call), "container" in g && e(9, C = g.container), "visible" in g && e(10, p = g.visible), "allow_overflow" in g && e(11, L = g.allow_overflow), "scale" in g && e(12, F = g.scale), "min_width" in g && e(13, c = g.min_width), "$$scope" in g && e(16, i = g.$$scope);
|
1504 |
+
}, [
|
1505 |
+
s,
|
1506 |
+
o,
|
1507 |
+
a,
|
1508 |
+
r,
|
1509 |
+
f,
|
1510 |
+
_,
|
1511 |
+
m,
|
1512 |
+
u,
|
1513 |
+
k,
|
1514 |
+
C,
|
1515 |
+
p,
|
1516 |
+
L,
|
1517 |
+
F,
|
1518 |
+
c,
|
1519 |
+
y,
|
1520 |
+
b,
|
1521 |
+
i,
|
1522 |
+
l
|
1523 |
+
];
|
1524 |
+
}
|
1525 |
+
class gl extends tl {
|
1526 |
+
constructor(t) {
|
1527 |
+
super(), rl(this, t, bl, ml, ul, {
|
1528 |
+
height: 0,
|
1529 |
+
width: 1,
|
1530 |
+
elem_id: 2,
|
1531 |
+
elem_classes: 3,
|
1532 |
+
variant: 4,
|
1533 |
+
border_mode: 5,
|
1534 |
+
padding: 6,
|
1535 |
+
type: 15,
|
1536 |
+
test_id: 7,
|
1537 |
+
explicit_call: 8,
|
1538 |
+
container: 9,
|
1539 |
+
visible: 10,
|
1540 |
+
allow_overflow: 11,
|
1541 |
+
scale: 12,
|
1542 |
+
min_width: 13
|
1543 |
+
});
|
1544 |
+
}
|
1545 |
+
}
|
1546 |
+
const hl = [
|
1547 |
+
{ color: "red", primary: 600, secondary: 100 },
|
1548 |
+
{ color: "green", primary: 600, secondary: 100 },
|
1549 |
+
{ color: "blue", primary: 600, secondary: 100 },
|
1550 |
+
{ color: "yellow", primary: 500, secondary: 100 },
|
1551 |
+
{ color: "purple", primary: 600, secondary: 100 },
|
1552 |
+
{ color: "teal", primary: 600, secondary: 100 },
|
1553 |
+
{ color: "orange", primary: 600, secondary: 100 },
|
1554 |
+
{ color: "cyan", primary: 600, secondary: 100 },
|
1555 |
+
{ color: "lime", primary: 500, secondary: 100 },
|
1556 |
+
{ color: "pink", primary: 600, secondary: 100 }
|
1557 |
+
], Xe = {
|
1558 |
+
inherit: "inherit",
|
1559 |
+
current: "currentColor",
|
1560 |
+
transparent: "transparent",
|
1561 |
+
black: "#000",
|
1562 |
+
white: "#fff",
|
1563 |
+
slate: {
|
1564 |
+
50: "#f8fafc",
|
1565 |
+
100: "#f1f5f9",
|
1566 |
+
200: "#e2e8f0",
|
1567 |
+
300: "#cbd5e1",
|
1568 |
+
400: "#94a3b8",
|
1569 |
+
500: "#64748b",
|
1570 |
+
600: "#475569",
|
1571 |
+
700: "#334155",
|
1572 |
+
800: "#1e293b",
|
1573 |
+
900: "#0f172a",
|
1574 |
+
950: "#020617"
|
1575 |
+
},
|
1576 |
+
gray: {
|
1577 |
+
50: "#f9fafb",
|
1578 |
+
100: "#f3f4f6",
|
1579 |
+
200: "#e5e7eb",
|
1580 |
+
300: "#d1d5db",
|
1581 |
+
400: "#9ca3af",
|
1582 |
+
500: "#6b7280",
|
1583 |
+
600: "#4b5563",
|
1584 |
+
700: "#374151",
|
1585 |
+
800: "#1f2937",
|
1586 |
+
900: "#111827",
|
1587 |
+
950: "#030712"
|
1588 |
+
},
|
1589 |
+
zinc: {
|
1590 |
+
50: "#fafafa",
|
1591 |
+
100: "#f4f4f5",
|
1592 |
+
200: "#e4e4e7",
|
1593 |
+
300: "#d4d4d8",
|
1594 |
+
400: "#a1a1aa",
|
1595 |
+
500: "#71717a",
|
1596 |
+
600: "#52525b",
|
1597 |
+
700: "#3f3f46",
|
1598 |
+
800: "#27272a",
|
1599 |
+
900: "#18181b",
|
1600 |
+
950: "#09090b"
|
1601 |
+
},
|
1602 |
+
neutral: {
|
1603 |
+
50: "#fafafa",
|
1604 |
+
100: "#f5f5f5",
|
1605 |
+
200: "#e5e5e5",
|
1606 |
+
300: "#d4d4d4",
|
1607 |
+
400: "#a3a3a3",
|
1608 |
+
500: "#737373",
|
1609 |
+
600: "#525252",
|
1610 |
+
700: "#404040",
|
1611 |
+
800: "#262626",
|
1612 |
+
900: "#171717",
|
1613 |
+
950: "#0a0a0a"
|
1614 |
+
},
|
1615 |
+
stone: {
|
1616 |
+
50: "#fafaf9",
|
1617 |
+
100: "#f5f5f4",
|
1618 |
+
200: "#e7e5e4",
|
1619 |
+
300: "#d6d3d1",
|
1620 |
+
400: "#a8a29e",
|
1621 |
+
500: "#78716c",
|
1622 |
+
600: "#57534e",
|
1623 |
+
700: "#44403c",
|
1624 |
+
800: "#292524",
|
1625 |
+
900: "#1c1917",
|
1626 |
+
950: "#0c0a09"
|
1627 |
+
},
|
1628 |
+
red: {
|
1629 |
+
50: "#fef2f2",
|
1630 |
+
100: "#fee2e2",
|
1631 |
+
200: "#fecaca",
|
1632 |
+
300: "#fca5a5",
|
1633 |
+
400: "#f87171",
|
1634 |
+
500: "#ef4444",
|
1635 |
+
600: "#dc2626",
|
1636 |
+
700: "#b91c1c",
|
1637 |
+
800: "#991b1b",
|
1638 |
+
900: "#7f1d1d",
|
1639 |
+
950: "#450a0a"
|
1640 |
+
},
|
1641 |
+
orange: {
|
1642 |
+
50: "#fff7ed",
|
1643 |
+
100: "#ffedd5",
|
1644 |
+
200: "#fed7aa",
|
1645 |
+
300: "#fdba74",
|
1646 |
+
400: "#fb923c",
|
1647 |
+
500: "#f97316",
|
1648 |
+
600: "#ea580c",
|
1649 |
+
700: "#c2410c",
|
1650 |
+
800: "#9a3412",
|
1651 |
+
900: "#7c2d12",
|
1652 |
+
950: "#431407"
|
1653 |
+
},
|
1654 |
+
amber: {
|
1655 |
+
50: "#fffbeb",
|
1656 |
+
100: "#fef3c7",
|
1657 |
+
200: "#fde68a",
|
1658 |
+
300: "#fcd34d",
|
1659 |
+
400: "#fbbf24",
|
1660 |
+
500: "#f59e0b",
|
1661 |
+
600: "#d97706",
|
1662 |
+
700: "#b45309",
|
1663 |
+
800: "#92400e",
|
1664 |
+
900: "#78350f",
|
1665 |
+
950: "#451a03"
|
1666 |
+
},
|
1667 |
+
yellow: {
|
1668 |
+
50: "#fefce8",
|
1669 |
+
100: "#fef9c3",
|
1670 |
+
200: "#fef08a",
|
1671 |
+
300: "#fde047",
|
1672 |
+
400: "#facc15",
|
1673 |
+
500: "#eab308",
|
1674 |
+
600: "#ca8a04",
|
1675 |
+
700: "#a16207",
|
1676 |
+
800: "#854d0e",
|
1677 |
+
900: "#713f12",
|
1678 |
+
950: "#422006"
|
1679 |
+
},
|
1680 |
+
lime: {
|
1681 |
+
50: "#f7fee7",
|
1682 |
+
100: "#ecfccb",
|
1683 |
+
200: "#d9f99d",
|
1684 |
+
300: "#bef264",
|
1685 |
+
400: "#a3e635",
|
1686 |
+
500: "#84cc16",
|
1687 |
+
600: "#65a30d",
|
1688 |
+
700: "#4d7c0f",
|
1689 |
+
800: "#3f6212",
|
1690 |
+
900: "#365314",
|
1691 |
+
950: "#1a2e05"
|
1692 |
+
},
|
1693 |
+
green: {
|
1694 |
+
50: "#f0fdf4",
|
1695 |
+
100: "#dcfce7",
|
1696 |
+
200: "#bbf7d0",
|
1697 |
+
300: "#86efac",
|
1698 |
+
400: "#4ade80",
|
1699 |
+
500: "#22c55e",
|
1700 |
+
600: "#16a34a",
|
1701 |
+
700: "#15803d",
|
1702 |
+
800: "#166534",
|
1703 |
+
900: "#14532d",
|
1704 |
+
950: "#052e16"
|
1705 |
+
},
|
1706 |
+
emerald: {
|
1707 |
+
50: "#ecfdf5",
|
1708 |
+
100: "#d1fae5",
|
1709 |
+
200: "#a7f3d0",
|
1710 |
+
300: "#6ee7b7",
|
1711 |
+
400: "#34d399",
|
1712 |
+
500: "#10b981",
|
1713 |
+
600: "#059669",
|
1714 |
+
700: "#047857",
|
1715 |
+
800: "#065f46",
|
1716 |
+
900: "#064e3b",
|
1717 |
+
950: "#022c22"
|
1718 |
+
},
|
1719 |
+
teal: {
|
1720 |
+
50: "#f0fdfa",
|
1721 |
+
100: "#ccfbf1",
|
1722 |
+
200: "#99f6e4",
|
1723 |
+
300: "#5eead4",
|
1724 |
+
400: "#2dd4bf",
|
1725 |
+
500: "#14b8a6",
|
1726 |
+
600: "#0d9488",
|
1727 |
+
700: "#0f766e",
|
1728 |
+
800: "#115e59",
|
1729 |
+
900: "#134e4a",
|
1730 |
+
950: "#042f2e"
|
1731 |
+
},
|
1732 |
+
cyan: {
|
1733 |
+
50: "#ecfeff",
|
1734 |
+
100: "#cffafe",
|
1735 |
+
200: "#a5f3fc",
|
1736 |
+
300: "#67e8f9",
|
1737 |
+
400: "#22d3ee",
|
1738 |
+
500: "#06b6d4",
|
1739 |
+
600: "#0891b2",
|
1740 |
+
700: "#0e7490",
|
1741 |
+
800: "#155e75",
|
1742 |
+
900: "#164e63",
|
1743 |
+
950: "#083344"
|
1744 |
+
},
|
1745 |
+
sky: {
|
1746 |
+
50: "#f0f9ff",
|
1747 |
+
100: "#e0f2fe",
|
1748 |
+
200: "#bae6fd",
|
1749 |
+
300: "#7dd3fc",
|
1750 |
+
400: "#38bdf8",
|
1751 |
+
500: "#0ea5e9",
|
1752 |
+
600: "#0284c7",
|
1753 |
+
700: "#0369a1",
|
1754 |
+
800: "#075985",
|
1755 |
+
900: "#0c4a6e",
|
1756 |
+
950: "#082f49"
|
1757 |
+
},
|
1758 |
+
blue: {
|
1759 |
+
50: "#eff6ff",
|
1760 |
+
100: "#dbeafe",
|
1761 |
+
200: "#bfdbfe",
|
1762 |
+
300: "#93c5fd",
|
1763 |
+
400: "#60a5fa",
|
1764 |
+
500: "#3b82f6",
|
1765 |
+
600: "#2563eb",
|
1766 |
+
700: "#1d4ed8",
|
1767 |
+
800: "#1e40af",
|
1768 |
+
900: "#1e3a8a",
|
1769 |
+
950: "#172554"
|
1770 |
+
},
|
1771 |
+
indigo: {
|
1772 |
+
50: "#eef2ff",
|
1773 |
+
100: "#e0e7ff",
|
1774 |
+
200: "#c7d2fe",
|
1775 |
+
300: "#a5b4fc",
|
1776 |
+
400: "#818cf8",
|
1777 |
+
500: "#6366f1",
|
1778 |
+
600: "#4f46e5",
|
1779 |
+
700: "#4338ca",
|
1780 |
+
800: "#3730a3",
|
1781 |
+
900: "#312e81",
|
1782 |
+
950: "#1e1b4b"
|
1783 |
+
},
|
1784 |
+
violet: {
|
1785 |
+
50: "#f5f3ff",
|
1786 |
+
100: "#ede9fe",
|
1787 |
+
200: "#ddd6fe",
|
1788 |
+
300: "#c4b5fd",
|
1789 |
+
400: "#a78bfa",
|
1790 |
+
500: "#8b5cf6",
|
1791 |
+
600: "#7c3aed",
|
1792 |
+
700: "#6d28d9",
|
1793 |
+
800: "#5b21b6",
|
1794 |
+
900: "#4c1d95",
|
1795 |
+
950: "#2e1065"
|
1796 |
+
},
|
1797 |
+
purple: {
|
1798 |
+
50: "#faf5ff",
|
1799 |
+
100: "#f3e8ff",
|
1800 |
+
200: "#e9d5ff",
|
1801 |
+
300: "#d8b4fe",
|
1802 |
+
400: "#c084fc",
|
1803 |
+
500: "#a855f7",
|
1804 |
+
600: "#9333ea",
|
1805 |
+
700: "#7e22ce",
|
1806 |
+
800: "#6b21a8",
|
1807 |
+
900: "#581c87",
|
1808 |
+
950: "#3b0764"
|
1809 |
+
},
|
1810 |
+
fuchsia: {
|
1811 |
+
50: "#fdf4ff",
|
1812 |
+
100: "#fae8ff",
|
1813 |
+
200: "#f5d0fe",
|
1814 |
+
300: "#f0abfc",
|
1815 |
+
400: "#e879f9",
|
1816 |
+
500: "#d946ef",
|
1817 |
+
600: "#c026d3",
|
1818 |
+
700: "#a21caf",
|
1819 |
+
800: "#86198f",
|
1820 |
+
900: "#701a75",
|
1821 |
+
950: "#4a044e"
|
1822 |
+
},
|
1823 |
+
pink: {
|
1824 |
+
50: "#fdf2f8",
|
1825 |
+
100: "#fce7f3",
|
1826 |
+
200: "#fbcfe8",
|
1827 |
+
300: "#f9a8d4",
|
1828 |
+
400: "#f472b6",
|
1829 |
+
500: "#ec4899",
|
1830 |
+
600: "#db2777",
|
1831 |
+
700: "#be185d",
|
1832 |
+
800: "#9d174d",
|
1833 |
+
900: "#831843",
|
1834 |
+
950: "#500724"
|
1835 |
+
},
|
1836 |
+
rose: {
|
1837 |
+
50: "#fff1f2",
|
1838 |
+
100: "#ffe4e6",
|
1839 |
+
200: "#fecdd3",
|
1840 |
+
300: "#fda4af",
|
1841 |
+
400: "#fb7185",
|
1842 |
+
500: "#f43f5e",
|
1843 |
+
600: "#e11d48",
|
1844 |
+
700: "#be123c",
|
1845 |
+
800: "#9f1239",
|
1846 |
+
900: "#881337",
|
1847 |
+
950: "#4c0519"
|
1848 |
+
}
|
1849 |
+
};
|
1850 |
+
hl.reduce(
|
1851 |
+
(n, { color: t, primary: e, secondary: l }) => ({
|
1852 |
+
...n,
|
1853 |
+
[t]: {
|
1854 |
+
primary: Xe[t][e],
|
1855 |
+
secondary: Xe[t][l]
|
1856 |
+
}
|
1857 |
+
}),
|
1858 |
+
{}
|
1859 |
+
);
|
1860 |
+
const {
|
1861 |
+
SvelteComponent: wl,
|
1862 |
+
assign: vl,
|
1863 |
+
attr: kl,
|
1864 |
+
create_component: ae,
|
1865 |
+
destroy_component: re,
|
1866 |
+
detach: Ye,
|
1867 |
+
element: yl,
|
1868 |
+
get_spread_object: pl,
|
1869 |
+
get_spread_update: ql,
|
1870 |
+
init: Fl,
|
1871 |
+
insert: Ge,
|
1872 |
+
mount_component: _e,
|
1873 |
+
safe_not_equal: Ll,
|
1874 |
+
space: Cl,
|
1875 |
+
toggle_class: Oe,
|
1876 |
+
transition_in: ue,
|
1877 |
+
transition_out: ce
|
1878 |
+
} = window.__gradio__svelte__internal;
|
1879 |
+
function Ml(n) {
|
1880 |
+
var r;
|
1881 |
+
let t, e, l, i, s;
|
1882 |
+
const o = [
|
1883 |
+
{ autoscroll: (
|
1884 |
+
/*gradio*/
|
1885 |
+
n[7].autoscroll
|
1886 |
+
) },
|
1887 |
+
{ i18n: (
|
1888 |
+
/*gradio*/
|
1889 |
+
n[7].i18n
|
1890 |
+
) },
|
1891 |
+
/*loading_status*/
|
1892 |
+
n[6],
|
1893 |
+
{ variant: "center" }
|
1894 |
+
];
|
1895 |
+
let a = {};
|
1896 |
+
for (let f = 0; f < o.length; f += 1)
|
1897 |
+
a = vl(a, o[f]);
|
1898 |
+
return t = new el({ props: a }), i = new mt({
|
1899 |
+
props: {
|
1900 |
+
min_height: (
|
1901 |
+
/*loading_status*/
|
1902 |
+
n[6] && /*loading_status*/
|
1903 |
+
((r = n[6]) == null ? void 0 : r.status) !== "complete"
|
1904 |
+
),
|
1905 |
+
value: (
|
1906 |
+
/*value*/
|
1907 |
+
n[3]
|
1908 |
+
),
|
1909 |
+
elem_classes: (
|
1910 |
+
/*elem_classes*/
|
1911 |
+
n[1]
|
1912 |
+
),
|
1913 |
+
visible: (
|
1914 |
+
/*visible*/
|
1915 |
+
n[2]
|
1916 |
+
),
|
1917 |
+
height: (
|
1918 |
+
/*height*/
|
1919 |
+
n[4]
|
1920 |
+
),
|
1921 |
+
width: (
|
1922 |
+
/*width*/
|
1923 |
+
n[5]
|
1924 |
+
)
|
1925 |
+
}
|
1926 |
+
}), i.$on(
|
1927 |
+
"change",
|
1928 |
+
/*change_handler*/
|
1929 |
+
n[9]
|
1930 |
+
), {
|
1931 |
+
c() {
|
1932 |
+
var f;
|
1933 |
+
ae(t.$$.fragment), e = Cl(), l = yl("div"), ae(i.$$.fragment), kl(l, "class", "svelte-gqsrr7"), Oe(
|
1934 |
+
l,
|
1935 |
+
"pending",
|
1936 |
+
/*loading_status*/
|
1937 |
+
((f = n[6]) == null ? void 0 : f.status) === "pending"
|
1938 |
+
);
|
1939 |
+
},
|
1940 |
+
m(f, _) {
|
1941 |
+
_e(t, f, _), Ge(f, e, _), Ge(f, l, _), _e(i, l, null), s = !0;
|
1942 |
+
},
|
1943 |
+
p(f, _) {
|
1944 |
+
var u, k;
|
1945 |
+
const m = _ & /*gradio, loading_status*/
|
1946 |
+
192 ? ql(o, [
|
1947 |
+
_ & /*gradio*/
|
1948 |
+
128 && { autoscroll: (
|
1949 |
+
/*gradio*/
|
1950 |
+
f[7].autoscroll
|
1951 |
+
) },
|
1952 |
+
_ & /*gradio*/
|
1953 |
+
128 && { i18n: (
|
1954 |
+
/*gradio*/
|
1955 |
+
f[7].i18n
|
1956 |
+
) },
|
1957 |
+
_ & /*loading_status*/
|
1958 |
+
64 && pl(
|
1959 |
+
/*loading_status*/
|
1960 |
+
f[6]
|
1961 |
+
),
|
1962 |
+
o[3]
|
1963 |
+
]) : {};
|
1964 |
+
t.$set(m);
|
1965 |
+
const b = {};
|
1966 |
+
_ & /*loading_status*/
|
1967 |
+
64 && (b.min_height = /*loading_status*/
|
1968 |
+
f[6] && /*loading_status*/
|
1969 |
+
((u = f[6]) == null ? void 0 : u.status) !== "complete"), _ & /*value*/
|
1970 |
+
8 && (b.value = /*value*/
|
1971 |
+
f[3]), _ & /*elem_classes*/
|
1972 |
+
2 && (b.elem_classes = /*elem_classes*/
|
1973 |
+
f[1]), _ & /*visible*/
|
1974 |
+
4 && (b.visible = /*visible*/
|
1975 |
+
f[2]), _ & /*height*/
|
1976 |
+
16 && (b.height = /*height*/
|
1977 |
+
f[4]), _ & /*width*/
|
1978 |
+
32 && (b.width = /*width*/
|
1979 |
+
f[5]), i.$set(b), (!s || _ & /*loading_status*/
|
1980 |
+
64) && Oe(
|
1981 |
+
l,
|
1982 |
+
"pending",
|
1983 |
+
/*loading_status*/
|
1984 |
+
((k = f[6]) == null ? void 0 : k.status) === "pending"
|
1985 |
+
);
|
1986 |
+
},
|
1987 |
+
i(f) {
|
1988 |
+
s || (ue(t.$$.fragment, f), ue(i.$$.fragment, f), s = !0);
|
1989 |
+
},
|
1990 |
+
o(f) {
|
1991 |
+
ce(t.$$.fragment, f), ce(i.$$.fragment, f), s = !1;
|
1992 |
+
},
|
1993 |
+
d(f) {
|
1994 |
+
f && (Ye(e), Ye(l)), re(t, f), re(i);
|
1995 |
+
}
|
1996 |
+
};
|
1997 |
+
}
|
1998 |
+
function Vl(n) {
|
1999 |
+
let t, e;
|
2000 |
+
return t = new gl({
|
2001 |
+
props: {
|
2002 |
+
visible: (
|
2003 |
+
/*visible*/
|
2004 |
+
n[2]
|
2005 |
+
),
|
2006 |
+
elem_id: (
|
2007 |
+
/*elem_id*/
|
2008 |
+
n[0]
|
2009 |
+
),
|
2010 |
+
elem_classes: (
|
2011 |
+
/*elem_classes*/
|
2012 |
+
n[1]
|
2013 |
+
),
|
2014 |
+
container: !1,
|
2015 |
+
height: (
|
2016 |
+
/*height*/
|
2017 |
+
n[4]
|
2018 |
+
),
|
2019 |
+
$$slots: { default: [Ml] },
|
2020 |
+
$$scope: { ctx: n }
|
2021 |
+
}
|
2022 |
+
}), {
|
2023 |
+
c() {
|
2024 |
+
ae(t.$$.fragment);
|
2025 |
+
},
|
2026 |
+
m(l, i) {
|
2027 |
+
_e(t, l, i), e = !0;
|
2028 |
+
},
|
2029 |
+
p(l, [i]) {
|
2030 |
+
const s = {};
|
2031 |
+
i & /*visible*/
|
2032 |
+
4 && (s.visible = /*visible*/
|
2033 |
+
l[2]), i & /*elem_id*/
|
2034 |
+
1 && (s.elem_id = /*elem_id*/
|
2035 |
+
l[0]), i & /*elem_classes*/
|
2036 |
+
2 && (s.elem_classes = /*elem_classes*/
|
2037 |
+
l[1]), i & /*height*/
|
2038 |
+
16 && (s.height = /*height*/
|
2039 |
+
l[4]), i & /*$$scope, loading_status, value, elem_classes, visible, height, width, gradio*/
|
2040 |
+
1278 && (s.$$scope = { dirty: i, ctx: l }), t.$set(s);
|
2041 |
+
},
|
2042 |
+
i(l) {
|
2043 |
+
e || (ue(t.$$.fragment, l), e = !0);
|
2044 |
+
},
|
2045 |
+
o(l) {
|
2046 |
+
ce(t.$$.fragment, l), e = !1;
|
2047 |
+
},
|
2048 |
+
d(l) {
|
2049 |
+
re(t, l);
|
2050 |
+
}
|
2051 |
+
};
|
2052 |
+
}
|
2053 |
+
function Sl(n, t, e) {
|
2054 |
+
let { label: l } = t, { elem_id: i = "" } = t, { elem_classes: s = [] } = t, { visible: o = !0 } = t, { value: a = "" } = t, { height: r = "100%" } = t, { width: f = "100%" } = t, { loading_status: _ } = t, { gradio: m } = t;
|
2055 |
+
const b = () => m.dispatch("change");
|
2056 |
+
return n.$$set = (u) => {
|
2057 |
+
"label" in u && e(8, l = u.label), "elem_id" in u && e(0, i = u.elem_id), "elem_classes" in u && e(1, s = u.elem_classes), "visible" in u && e(2, o = u.visible), "value" in u && e(3, a = u.value), "height" in u && e(4, r = u.height), "width" in u && e(5, f = u.width), "loading_status" in u && e(6, _ = u.loading_status), "gradio" in u && e(7, m = u.gradio);
|
2058 |
+
}, n.$$.update = () => {
|
2059 |
+
n.$$.dirty & /*label, gradio*/
|
2060 |
+
384 && m.dispatch("change");
|
2061 |
+
}, [
|
2062 |
+
i,
|
2063 |
+
s,
|
2064 |
+
o,
|
2065 |
+
a,
|
2066 |
+
r,
|
2067 |
+
f,
|
2068 |
+
_,
|
2069 |
+
m,
|
2070 |
+
l,
|
2071 |
+
b
|
2072 |
+
];
|
2073 |
+
}
|
2074 |
+
class Nl extends wl {
|
2075 |
+
constructor(t) {
|
2076 |
+
super(), Fl(this, t, Sl, Vl, Ll, {
|
2077 |
+
label: 8,
|
2078 |
+
elem_id: 0,
|
2079 |
+
elem_classes: 1,
|
2080 |
+
visible: 2,
|
2081 |
+
value: 3,
|
2082 |
+
height: 4,
|
2083 |
+
width: 5,
|
2084 |
+
loading_status: 6,
|
2085 |
+
gradio: 7
|
2086 |
+
});
|
2087 |
+
}
|
2088 |
+
}
|
2089 |
+
export {
|
2090 |
+
Nl as default
|
2091 |
+
};
|
component/gradio_iframe/templates/component/style.css
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.min.svelte-2qygph{min-height:var(--size-24)}.hide.svelte-2qygph{display:none}svg.svelte-43sxxs.svelte-43sxxs{width:var(--size-20);height:var(--size-20)}svg.svelte-43sxxs path.svelte-43sxxs{fill:var(--loader-color)}div.svelte-43sxxs.svelte-43sxxs{z-index:var(--layer-2)}.margin.svelte-43sxxs.svelte-43sxxs{margin:var(--size-4)}.wrap.svelte-1txqlrd.svelte-1txqlrd{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-top);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);max-height:var(--size-screen-h);overflow:hidden;pointer-events:none}.wrap.center.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;left:0}.wrap.default.svelte-1txqlrd.svelte-1txqlrd{top:0;right:0;bottom:0;left:0}.hide.svelte-1txqlrd.svelte-1txqlrd{opacity:0;pointer-events:none}.generating.svelte-1txqlrd.svelte-1txqlrd{animation:svelte-1txqlrd-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent}.translucent.svelte-1txqlrd.svelte-1txqlrd{background:none}@keyframes svelte-1txqlrd-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1txqlrd.svelte-1txqlrd{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1txqlrd.svelte-1txqlrd{position:absolute;top:0;right:0;bottom:0;left:0;transform-origin:left;opacity:.8;z-index:var(--layer-1);transition:10ms;background:var(--background-fill-secondary)}.progress-bar-wrap.svelte-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1txqlrd.svelte-1txqlrd{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1txqlrd.svelte-1txqlrd{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1txqlrd.svelte-1txqlrd{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1txqlrd.svelte-1txqlrd{position:absolute;top:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text-center.svelte-1txqlrd.svelte-1txqlrd{display:flex;position:absolute;top:0;right:0;justify-content:center;align-items:center;transform:translateY(var(--size-6));z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);text-align:center}.error.svelte-1txqlrd.svelte-1txqlrd{box-shadow:var(--shadow-drop);border:solid 1px var(--error-border-color);border-radius:var(--radius-full);background:var(--error-background-fill);padding-right:var(--size-4);padding-left:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font)}.minimal.svelte-1txqlrd .progress-text.svelte-1txqlrd{background:var(--block-background-fill)}.border.svelte-1txqlrd.svelte-1txqlrd{border:1px solid var(--border-color-primary)}.dropdown-arrow.svelte-145leq6{fill:currentColor}.toast-body.svelte-solcu7{display:flex;position:relative;right:0;left:0;align-items:center;margin:var(--size-6) var(--size-4);margin:auto;border-radius:var(--container-radius);overflow:hidden;pointer-events:auto}.toast-body.error.svelte-solcu7{border:1px solid var(--color-red-700);background:var(--color-red-50)}.dark .toast-body.error.svelte-solcu7{border:1px solid var(--color-red-500);background-color:var(--color-grey-950)}.toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-700);background:var(--color-yellow-50)}.dark .toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-500);background-color:var(--color-grey-950)}.toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-700);background:var(--color-grey-50)}.dark .toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-500);background-color:var(--color-grey-950)}.toast-title.svelte-solcu7{display:flex;align-items:center;font-weight:var(--weight-bold);font-size:var(--text-lg);line-height:var(--line-sm);text-transform:capitalize}.toast-title.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-title.error.svelte-solcu7{color:var(--color-red-50)}.toast-title.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-title.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-title.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-title.info.svelte-solcu7{color:var(--color-grey-50)}.toast-close.svelte-solcu7{margin:0 var(--size-3);border-radius:var(--size-3);padding:0px var(--size-1-5);font-size:var(--size-5);line-height:var(--size-5)}.toast-close.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-close.error.svelte-solcu7{color:var(--color-red-500)}.toast-close.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-close.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-close.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-close.info.svelte-solcu7{color:var(--color-grey-500)}.toast-text.svelte-solcu7{font-size:var(--text-lg)}.toast-text.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-text.error.svelte-solcu7{color:var(--color-red-50)}.toast-text.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-text.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-text.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-text.info.svelte-solcu7{color:var(--color-grey-50)}.toast-details.svelte-solcu7{margin:var(--size-3) var(--size-3) var(--size-3) 0;width:100%}.toast-icon.svelte-solcu7{display:flex;position:absolute;position:relative;flex-shrink:0;justify-content:center;align-items:center;margin:var(--size-2);border-radius:var(--radius-full);padding:var(--size-1);padding-left:calc(var(--size-1) - 1px);width:35px;height:35px}.toast-icon.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-icon.error.svelte-solcu7{color:var(--color-red-500)}.toast-icon.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-icon.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-icon.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-icon.info.svelte-solcu7{color:var(--color-grey-500)}@keyframes svelte-solcu7-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.timer.svelte-solcu7{position:absolute;bottom:0;left:0;transform-origin:0 0;animation:svelte-solcu7-countdown 10s linear forwards;width:100%;height:var(--size-1)}.timer.error.svelte-solcu7{background:var(--color-red-700)}.dark .timer.error.svelte-solcu7{background:var(--color-red-500)}.timer.warning.svelte-solcu7{background:var(--color-yellow-700)}.dark .timer.warning.svelte-solcu7{background:var(--color-yellow-500)}.timer.info.svelte-solcu7{background:var(--color-grey-700)}.dark .timer.info.svelte-solcu7{background:var(--color-grey-500)}.toast-wrap.svelte-gatr8h{display:flex;position:fixed;top:var(--size-4);right:var(--size-4);flex-direction:column;align-items:end;gap:var(--size-2);z-index:var(--layer-top);width:calc(100% - var(--size-8))}@media (--screen-sm){.toast-wrap.svelte-gatr8h{width:calc(var(--size-96) + var(--size-10))}}.block.svelte-1t38q2d{position:relative;margin:0;box-shadow:var(--block-shadow);border-width:var(--block-border-width);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);width:100%;line-height:var(--line-sm)}.block.border_focus.svelte-1t38q2d{border-color:var(--color-accent)}.padded.svelte-1t38q2d{padding:var(--block-padding)}.hidden.svelte-1t38q2d{display:none}.hide-container.svelte-1t38q2d{margin:0;box-shadow:none;--block-border-width:0;background:transparent;padding:0;overflow:visible}div.svelte-1hnfib2{margin-bottom:var(--spacing-lg);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}span.has-info.svelte-22c38v{margin-bottom:var(--spacing-xs)}span.svelte-22c38v:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-22c38v{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-22c38v{margin:0;height:0}label.svelte-9gxdi0{display:inline-flex;align-items:center;z-index:var(--layer-2);box-shadow:var(--block-label-shadow);border:var(--block-label-border-width) solid var(--border-color-primary);border-top:none;border-left:none;border-radius:var(--block-label-radius);background:var(--block-label-background-fill);padding:var(--block-label-padding);pointer-events:none;color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.gr-group label.svelte-9gxdi0{border-top-left-radius:0}label.float.svelte-9gxdi0{position:absolute;top:var(--block-label-margin);left:var(--block-label-margin)}label.svelte-9gxdi0:not(.float){position:static;margin-top:var(--block-label-margin);margin-left:var(--block-label-margin)}.hide.svelte-9gxdi0{height:0}span.svelte-9gxdi0{opacity:.8;margin-right:var(--size-2);width:calc(var(--block-label-text-size) - 1px);height:calc(var(--block-label-text-size) - 1px)}.hide-label.svelte-9gxdi0{box-shadow:none;border-width:0;background:transparent;overflow:visible}button.svelte-lpi64a{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);border-radius:var(--radius-sm);color:var(--block-label-text-color);border:1px solid transparent}button[disabled].svelte-lpi64a{opacity:.5;box-shadow:none}button[disabled].svelte-lpi64a:hover{cursor:not-allowed}.padded.svelte-lpi64a{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-lpi64a:hover,button.highlight.svelte-lpi64a{cursor:pointer;color:var(--color-accent)}.padded.svelte-lpi64a:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-lpi64a{padding:0 1px;font-size:10px}div.svelte-lpi64a{padding:2px;display:flex;align-items:flex-end}.small.svelte-lpi64a{width:14px;height:14px}.large.svelte-lpi64a{width:22px;height:22px}.pending.svelte-lpi64a{animation:svelte-lpi64a-flash .5s infinite}@keyframes svelte-lpi64a-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-lpi64a{background:transparent;border:none;box-shadow:none}.empty.svelte-3w3rth{display:flex;justify-content:center;align-items:center;margin-top:calc(0px - var(--size-6));height:var(--size-full)}.icon.svelte-3w3rth{opacity:.5;height:var(--size-5);color:var(--body-text-color)}.small.svelte-3w3rth{min-height:calc(var(--size-32) - 20px)}.large.svelte-3w3rth{min-height:calc(var(--size-64) - 20px)}.unpadded_box.svelte-3w3rth{margin-top:0}.small_parent.svelte-3w3rth{min-height:100%!important}.wrap.svelte-kzcjhc{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);line-height:var(--line-md);height:100%;padding-top:var(--size-3)}.or.svelte-kzcjhc{color:var(--body-text-color-subdued);display:flex}.icon-wrap.svelte-kzcjhc{width:30px;margin-bottom:var(--spacing-lg)}@media (--screen-md){.wrap.svelte-kzcjhc{font-size:var(--text-lg)}}.hovered.svelte-kzcjhc{color:var(--color-accent)}div.svelte-ipfyu7{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;padding-bottom:var(--spacing-xl);color:var(--block-label-text-color);flex-shrink:0;width:95%}.show_border.svelte-ipfyu7{border-top:1px solid var(--block-border-color);margin-top:var(--spacing-xxl);box-shadow:var(--shadow-drop)}.source-selection.svelte-lde7lt{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:95%;bottom:0;left:0;right:0;margin-left:auto;margin-right:auto;align-self:flex-end}.icon.svelte-lde7lt{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.selected.svelte-lde7lt{color:var(--color-accent)}.icon.svelte-lde7lt:hover,.icon.svelte-lde7lt:focus{color:var(--color-accent)}div.svelte-gqsrr7{transition:.15s}.pending.svelte-gqsrr7{opacity:.2}
|
component/gradio_iframe/templates/example/index.js
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const {
|
2 |
+
SvelteComponent: r,
|
3 |
+
append: d,
|
4 |
+
attr: s,
|
5 |
+
detach: u,
|
6 |
+
element: o,
|
7 |
+
init: g,
|
8 |
+
insert: m,
|
9 |
+
noop: _,
|
10 |
+
safe_not_equal: v,
|
11 |
+
toggle_class: c
|
12 |
+
} = window.__gradio__svelte__internal;
|
13 |
+
function y(n) {
|
14 |
+
let e, l;
|
15 |
+
return {
|
16 |
+
c() {
|
17 |
+
e = o("div"), l = o("iframe"), s(l, "title", "iframe component"), s(l, "width", "100%"), s(l, "height", "1000px"), s(
|
18 |
+
l,
|
19 |
+
"srcdoc",
|
20 |
+
/*value*/
|
21 |
+
n[0]
|
22 |
+
), s(l, "allow", ""), s(e, "class", "prose svelte-180qqaf"), c(
|
23 |
+
e,
|
24 |
+
"table",
|
25 |
+
/*type*/
|
26 |
+
n[1] === "table"
|
27 |
+
), c(
|
28 |
+
e,
|
29 |
+
"gallery",
|
30 |
+
/*type*/
|
31 |
+
n[1] === "gallery"
|
32 |
+
), c(
|
33 |
+
e,
|
34 |
+
"selected",
|
35 |
+
/*selected*/
|
36 |
+
n[2]
|
37 |
+
);
|
38 |
+
},
|
39 |
+
m(t, a) {
|
40 |
+
m(t, e, a), d(e, l);
|
41 |
+
},
|
42 |
+
p(t, [a]) {
|
43 |
+
a & /*value*/
|
44 |
+
1 && s(
|
45 |
+
l,
|
46 |
+
"srcdoc",
|
47 |
+
/*value*/
|
48 |
+
t[0]
|
49 |
+
), a & /*type*/
|
50 |
+
2 && c(
|
51 |
+
e,
|
52 |
+
"table",
|
53 |
+
/*type*/
|
54 |
+
t[1] === "table"
|
55 |
+
), a & /*type*/
|
56 |
+
2 && c(
|
57 |
+
e,
|
58 |
+
"gallery",
|
59 |
+
/*type*/
|
60 |
+
t[1] === "gallery"
|
61 |
+
), a & /*selected*/
|
62 |
+
4 && c(
|
63 |
+
e,
|
64 |
+
"selected",
|
65 |
+
/*selected*/
|
66 |
+
t[2]
|
67 |
+
);
|
68 |
+
},
|
69 |
+
i: _,
|
70 |
+
o: _,
|
71 |
+
d(t) {
|
72 |
+
t && u(e);
|
73 |
+
}
|
74 |
+
};
|
75 |
+
}
|
76 |
+
function h(n, e, l) {
|
77 |
+
let { value: t } = e, { type: a } = e, { selected: f = !1 } = e;
|
78 |
+
return n.$$set = (i) => {
|
79 |
+
"value" in i && l(0, t = i.value), "type" in i && l(1, a = i.type), "selected" in i && l(2, f = i.selected);
|
80 |
+
}, [t, a, f];
|
81 |
+
}
|
82 |
+
class b extends r {
|
83 |
+
constructor(e) {
|
84 |
+
super(), g(this, e, h, y, v, { value: 0, type: 1, selected: 2 });
|
85 |
+
}
|
86 |
+
}
|
87 |
+
export {
|
88 |
+
b as default
|
89 |
+
};
|
component/gradio_iframe/templates/example/style.css
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.gallery.svelte-180qqaf{padding:var(--size-2)}
|
html_source/example.html
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
|
3 |
+
<head>
|
4 |
+
<title>
|
5 |
+
Google
|
6 |
+
</title>
|
7 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet" />
|
8 |
+
<style>
|
9 |
+
body {
|
10 |
+
margin: 0;
|
11 |
+
font-family: Arial, sans-serif;
|
12 |
+
background-color: #ffffff;
|
13 |
+
color: #202124;
|
14 |
+
text-align: center;
|
15 |
+
}
|
16 |
+
|
17 |
+
.header {
|
18 |
+
display: flex;
|
19 |
+
justify-content: flex-end;
|
20 |
+
padding: 10px 20px;
|
21 |
+
}
|
22 |
+
|
23 |
+
.header a {
|
24 |
+
margin-left: 15px;
|
25 |
+
color: #5f6368;
|
26 |
+
text-decoration: none;
|
27 |
+
}
|
28 |
+
|
29 |
+
.logo {
|
30 |
+
margin-top: 100px;
|
31 |
+
}
|
32 |
+
|
33 |
+
.search-bar {
|
34 |
+
margin-top: 20px;
|
35 |
+
}
|
36 |
+
|
37 |
+
.search-bar input[type="text"] {
|
38 |
+
width: 500px;
|
39 |
+
height: 44px;
|
40 |
+
padding: 0 15px;
|
41 |
+
border: 1px solid #dfe1e5;
|
42 |
+
border-radius: 24px;
|
43 |
+
font-size: 16px;
|
44 |
+
}
|
45 |
+
|
46 |
+
.search-bar input[type="text"]:focus {
|
47 |
+
outline: none;
|
48 |
+
box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
|
49 |
+
border-color: rgba(223, 225, 229, 0);
|
50 |
+
}
|
51 |
+
|
52 |
+
.search-bar .buttons {
|
53 |
+
margin-top: 20px;
|
54 |
+
}
|
55 |
+
|
56 |
+
.search-bar .buttons input {
|
57 |
+
background-color: #f8f9fa;
|
58 |
+
border: 1px solid #f8f9fa;
|
59 |
+
border-radius: 4px;
|
60 |
+
color: #3c4043;
|
61 |
+
font-size: 14px;
|
62 |
+
margin: 11px 4px;
|
63 |
+
padding: 0 16px;
|
64 |
+
line-height: 27px;
|
65 |
+
height: 36px;
|
66 |
+
cursor: pointer;
|
67 |
+
}
|
68 |
+
|
69 |
+
.search-bar .buttons input:hover {
|
70 |
+
border: 1px solid #dadce0;
|
71 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
|
72 |
+
color: #202124;
|
73 |
+
}
|
74 |
+
|
75 |
+
.footer {
|
76 |
+
position: absolute;
|
77 |
+
bottom: 0;
|
78 |
+
width: 100%;
|
79 |
+
background-color: #f2f2f2;
|
80 |
+
padding: 15px 0;
|
81 |
+
font-size: 14px;
|
82 |
+
color: #70757a;
|
83 |
+
}
|
84 |
+
|
85 |
+
.footer a {
|
86 |
+
color: #70757a;
|
87 |
+
text-decoration: none;
|
88 |
+
margin: 0 15px;
|
89 |
+
}
|
90 |
+
|
91 |
+
.footer a:hover {
|
92 |
+
text-decoration: underline;
|
93 |
+
}
|
94 |
+
</style>
|
95 |
+
</head>
|
96 |
+
|
97 |
+
<body>
|
98 |
+
<div class="header">
|
99 |
+
<a href="#">
|
100 |
+
Gmail
|
101 |
+
</a>
|
102 |
+
<a href="#">
|
103 |
+
Images
|
104 |
+
</a>
|
105 |
+
<i class="fas fa-th">
|
106 |
+
</i>
|
107 |
+
<img alt="User profile image" height="30"
|
108 |
+
src="https://oaidalleapiprodscus.blob.core.windows.net/private/org-qHvAwasSl7ckNxotJHsrZlqY/user-GhnzchW8QBYQeN5nXbHW9TAW/img-M22MT4Njh6LjX3WZXOstgSry.png?st=2024-09-09T07%3A00%3A08Z&se=2024-09-09T09%3A00%3A08Z&sp=r&sv=2024-08-04&sr=b&rscd=inline&rsct=image/png&skoid=d505667d-d6c1-4a0a-bac7-5c84a87759f8&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2024-09-08T22%3A30%3A58Z&ske=2024-09-09T22%3A30%3A58Z&sks=b&skv=2024-08-04&sig=4ZG7FAJqSFlepyn87fidiUgPfUvR0ZUSyz5GreCaQaQ%3D"
|
109 |
+
style="border-radius: 50%; margin-left: 15px;" width="30" />
|
110 |
+
</div>
|
111 |
+
<div class="logo">
|
112 |
+
<img alt="Google Doodle image" height="92"
|
113 |
+
src="https://oaidalleapiprodscus.blob.core.windows.net/private/org-qHvAwasSl7ckNxotJHsrZlqY/user-GhnzchW8QBYQeN5nXbHW9TAW/img-UQQyOCc4PWXjrOcEEsIsfnYl.png?st=2024-09-09T07%3A00%3A09Z&se=2024-09-09T09%3A00%3A09Z&sp=r&sv=2024-08-04&sr=b&rscd=inline&rsct=image/png&skoid=d505667d-d6c1-4a0a-bac7-5c84a87759f8&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2024-09-08T21%3A32%3A42Z&ske=2024-09-09T21%3A32%3A42Z&sks=b&skv=2024-08-04&sig=Mq8Y%2By8kKB4snB96KEX9nlDXEMGoG5Lv3lpMMBrhzpg%3D"
|
114 |
+
width="272" />
|
115 |
+
</div>
|
116 |
+
<div class="search-bar">
|
117 |
+
<input placeholder="Search Google or type a URL" type="text" />
|
118 |
+
<div class="buttons">
|
119 |
+
<input type="button" value="Google Search" />
|
120 |
+
<input type="button" value="I'm Feeling Lucky" />
|
121 |
+
</div>
|
122 |
+
<div style="margin-top: 20px;">
|
123 |
+
Google offered in:
|
124 |
+
<a href="#">
|
125 |
+
繁體中文
|
126 |
+
</a>
|
127 |
+
</div>
|
128 |
+
</div>
|
129 |
+
<div class="footer">
|
130 |
+
<div>
|
131 |
+
Taiwan
|
132 |
+
</div>
|
133 |
+
<div>
|
134 |
+
<a href="#">
|
135 |
+
About
|
136 |
+
</a>
|
137 |
+
<a href="#">
|
138 |
+
Advertising
|
139 |
+
</a>
|
140 |
+
<a href="#">
|
141 |
+
Business
|
142 |
+
</a>
|
143 |
+
<a href="#">
|
144 |
+
How Search works
|
145 |
+
</a>
|
146 |
+
</div>
|
147 |
+
<div>
|
148 |
+
<a href="#">
|
149 |
+
Privacy
|
150 |
+
</a>
|
151 |
+
<a href="#">
|
152 |
+
Terms
|
153 |
+
</a>
|
154 |
+
<a href="#">
|
155 |
+
Settings
|
156 |
+
</a>
|
157 |
+
</div>
|
158 |
+
</div>
|
159 |
+
</body>
|
160 |
+
|
161 |
+
</html>
|
html_source/example2.html
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
|
3 |
+
<head>
|
4 |
+
<title>Google</title>
|
5 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
6 |
+
<style>
|
7 |
+
body {
|
8 |
+
margin: 0;
|
9 |
+
font-family: Arial, sans-serif;
|
10 |
+
background-color: #ffffff;
|
11 |
+
color: #202124;
|
12 |
+
text-align: center;
|
13 |
+
|
14 |
+
}
|
15 |
+
|
16 |
+
.header {
|
17 |
+
display: flex;
|
18 |
+
justify-content: flex-end;
|
19 |
+
padding: 10px 20px;
|
20 |
+
|
21 |
+
}
|
22 |
+
|
23 |
+
.header a {
|
24 |
+
margin-left: 15px;
|
25 |
+
color: #5f6368;
|
26 |
+
text-decoration: none;
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
.logo {
|
31 |
+
margin-top: 100px;
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
.search-bar {
|
36 |
+
margin-top: 20px;
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
.search-bar input[type="text"] {
|
41 |
+
width: 500px;
|
42 |
+
height: 44px;
|
43 |
+
padding: 0 15px;
|
44 |
+
border: 1px solid #dfe1e5;
|
45 |
+
border-radius: 24px;
|
46 |
+
font-size: 16px;
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
.search-bar input[type="text"]:focus {
|
51 |
+
outline: none;
|
52 |
+
box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
|
53 |
+
border-color: rgba(223, 225, 229, 0);
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
.search-bar .buttons {
|
58 |
+
margin-top: 20px;
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
.search-bar .buttons input {
|
63 |
+
background-color: #f8f9fa;
|
64 |
+
border: 1px solid #f8f9fa;
|
65 |
+
border-radius: 4px;
|
66 |
+
color: #3c4043;
|
67 |
+
font-size: 14px;
|
68 |
+
margin: 11px 4px;
|
69 |
+
padding: 0 16px;
|
70 |
+
line-height: 27px;
|
71 |
+
height: 36px;
|
72 |
+
cursor: pointer;
|
73 |
+
|
74 |
+
}
|
75 |
+
|
76 |
+
.search-bar .buttons input:hover {
|
77 |
+
border: 1px solid #dadce0;
|
78 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
|
79 |
+
color: #202124;
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
.footer {
|
84 |
+
position: absolute;
|
85 |
+
bottom: 0;
|
86 |
+
width: 100%;
|
87 |
+
background-color: #f2f2f2;
|
88 |
+
padding: 15px 0;
|
89 |
+
font-size: 14px;
|
90 |
+
color: #70757a;
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
+
.footer a {
|
95 |
+
color: #70757a;
|
96 |
+
text-decoration: none;
|
97 |
+
margin: 0 15px;
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
.footer a:hover {
|
102 |
+
text-decoration: underline;
|
103 |
+
|
104 |
+
}
|
105 |
+
</style>
|
106 |
+
</head>
|
107 |
+
|
108 |
+
<body>
|
109 |
+
<div class="header"> <a href="#">Gmail</a> <a href="#">Images</a> <i class="fas fa-th"></i>
|
110 |
+
<img src="https://placehold.co/30x30" alt="User profile image" style="border-radius: 50%; margin-left:
|
111 |
+
15px;">
|
112 |
+
</div>
|
113 |
+
<div class="logo"> <img src="https://placehold.co/272x92" alt="Google Doodle image"> </div>
|
114 |
+
<div class="search-bar"> <input type="text" placeholder="Search Google or type a URL">
|
115 |
+
<div class="buttons"> <input type="button" value="Google Search"> <input type="button" value="I'm
|
116 |
+
Feeling Lucky"> </div>
|
117 |
+
<div style="margin-top: 20px;"> Google offered in: <a href="#">u7e41u9ad4u4e2du6587</a> </div>
|
118 |
+
</div>
|
119 |
+
<div class="footer">
|
120 |
+
<div>Taiwan</div>
|
121 |
+
<div> <a href="#">About</a> <a href="#">Advertising</a> <a href="#">Business</a> <a href="#">How
|
122 |
+
Search works</a> </div>
|
123 |
+
<div> <a href="#">Privacy</a> <a href="#">Terms</a> <a href="#">Settings</a> </div>
|
124 |
+
</div>
|
125 |
+
</body>
|
126 |
+
|
127 |
+
</html>
|
html_source/experiment1.html
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap" rel="stylesheet">
|
7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
8 |
+
<title>Google</title>
|
9 |
+
<style>
|
10 |
+
body {
|
11 |
+
display: flex;
|
12 |
+
flex-direction: column;
|
13 |
+
justify-content: space-between;
|
14 |
+
/* Adjusted alignment */
|
15 |
+
height: 100vh;
|
16 |
+
margin: 0;
|
17 |
+
font-family: 'Roboto', sans-serif;
|
18 |
+
background-color: white;
|
19 |
+
}
|
20 |
+
|
21 |
+
.logo {
|
22 |
+
margin-top: 50px;
|
23 |
+
/* Adjusted top margin */
|
24 |
+
}
|
25 |
+
|
26 |
+
.search-bar {
|
27 |
+
display: flex;
|
28 |
+
justify-content: center;
|
29 |
+
}
|
30 |
+
|
31 |
+
.search-input {
|
32 |
+
width: 600px;
|
33 |
+
height: 40px;
|
34 |
+
border: 1px solid #dcdcdc;
|
35 |
+
border-radius: 24px;
|
36 |
+
padding: 0 20px;
|
37 |
+
font-size: 16px;
|
38 |
+
}
|
39 |
+
|
40 |
+
.buttons {
|
41 |
+
display: flex;
|
42 |
+
justify-content: center;
|
43 |
+
margin-top: 20px;
|
44 |
+
}
|
45 |
+
|
46 |
+
.buttons button {
|
47 |
+
background-color: #f8f8f8;
|
48 |
+
border: 1px solid #dcdcdc;
|
49 |
+
border-radius: 4px;
|
50 |
+
padding: 10px 20px;
|
51 |
+
margin: 0 4px;
|
52 |
+
cursor: pointer;
|
53 |
+
font-size: 14px;
|
54 |
+
}
|
55 |
+
|
56 |
+
.google-offered {
|
57 |
+
display: flex;
|
58 |
+
justify-content: center;
|
59 |
+
font-size: 14px;
|
60 |
+
color: #777;
|
61 |
+
}
|
62 |
+
|
63 |
+
.footer {
|
64 |
+
background-color: #f2f2f2;
|
65 |
+
/* Added background color */
|
66 |
+
width: 100%;
|
67 |
+
/* Full width */
|
68 |
+
text-align: center;
|
69 |
+
/* Centered text */
|
70 |
+
padding: 10px 0;
|
71 |
+
/* Padding for spacing */
|
72 |
+
font-size: 14px;
|
73 |
+
color: #777;
|
74 |
+
border-top: 1px solid #dcdcdc;
|
75 |
+
/* Top border */
|
76 |
+
}
|
77 |
+
</style>
|
78 |
+
</head>
|
79 |
+
|
80 |
+
<body>
|
81 |
+
<div class="logo">
|
82 |
+
<img src="https://placehold.co/400x200.png?text=Google+Doodle" alt="Google Doodle" width="400">
|
83 |
+
</div>
|
84 |
+
<div class="search-bar">
|
85 |
+
<input type="text" class="search-input" placeholder="Search Google or type a URL">
|
86 |
+
</div>
|
87 |
+
<div class="buttons">
|
88 |
+
<button>Google Search</button>
|
89 |
+
<button>I'm Feeling Lucky</button>
|
90 |
+
</div>
|
91 |
+
<div class="google-offered">Google offered in: <a href="#">繁體中文</a></div>
|
92 |
+
<div class="footer">
|
93 |
+
Taiwan<br>
|
94 |
+
About | Advertising | Business | How Search works
|
95 |
+
</div>
|
96 |
+
</body>
|
97 |
+
|
98 |
+
</html>
|
main.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random
|
2 |
+
from chatAPI import chat
|
3 |
+
import httpx
|
4 |
+
from openai import OpenAI
|
5 |
+
from pages.home import interface
|
6 |
+
|
7 |
+
|
8 |
+
demo=interface()
|
9 |
+
demo.launch()
|
10 |
+
|
pages/__pycache__/home.cpython-38.pyc
ADDED
Binary file (4.6 kB). View file
|
|
pages/home.py
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from PIL import Image
|
3 |
+
import base64
|
4 |
+
import io
|
5 |
+
from utils.tools import txt2string,base64_convert
|
6 |
+
from component.gradio_iframe import iFrame
|
7 |
+
from chatbots.initialization_bot.chatbot import Chatbot as InitialBot
|
8 |
+
from chatbots.improvement_bot.chatbot import Chatbot as ImproveBot
|
9 |
+
from chatbots.repolish_bot.chatbot import Chatbot as PolistBot
|
10 |
+
|
11 |
+
|
12 |
+
def process_inputs(session_state,image):
|
13 |
+
session_state['screen_shot']=base64_convert(image)
|
14 |
+
return session_state
|
15 |
+
|
16 |
+
def generate_code(session_state):
|
17 |
+
base64_img=session_state['screen_shot']
|
18 |
+
|
19 |
+
initial_bot=InitialBot()
|
20 |
+
|
21 |
+
result=initial_bot.generate_code(base64_img)
|
22 |
+
session_state['html_source']=result
|
23 |
+
return result,result,session_state
|
24 |
+
|
25 |
+
def improve_code(session_state):
|
26 |
+
base64_img=session_state['screen_shot']
|
27 |
+
html_source=session_state['html_source']
|
28 |
+
|
29 |
+
chatbot=ImproveBot()
|
30 |
+
result=chatbot.generate_code(html_source,base64_img)
|
31 |
+
session_state['html_source']=result
|
32 |
+
return result,result,session_state
|
33 |
+
|
34 |
+
default_source=txt2string('./html_source/experiment1.html')
|
35 |
+
|
36 |
+
def initial_state():
|
37 |
+
state={
|
38 |
+
'name':'session state',
|
39 |
+
'screen_shot':None,
|
40 |
+
'html_source':default_source,
|
41 |
+
}
|
42 |
+
return state
|
43 |
+
|
44 |
+
def repolish(session_state,chat_input):
|
45 |
+
html_source=session_state['html_source']
|
46 |
+
reference_img=session_state['screen_shot']
|
47 |
+
current_img=base64_convert(chat_input['files'][0])
|
48 |
+
chatbot=PolistBot()
|
49 |
+
result=chatbot.generate_code(chat_input['text'],html_source,[reference_img,current_img])
|
50 |
+
return result,result
|
51 |
+
|
52 |
+
|
53 |
+
def render(session_state,source):
|
54 |
+
session_state['html_source']=source
|
55 |
+
return session_state,source
|
56 |
+
|
57 |
+
|
58 |
+
def interface():
|
59 |
+
with gr.Blocks() as demo:
|
60 |
+
session_state =gr.State(initial_state)
|
61 |
+
with gr.Tab("Generate"):
|
62 |
+
with gr.Row():
|
63 |
+
with gr.Column():
|
64 |
+
gr.Markdown(
|
65 |
+
"""
|
66 |
+
# [A Large Language Model Converting UI to Codes] 🔍
|
67 |
+
"""
|
68 |
+
)
|
69 |
+
gr.Markdown(
|
70 |
+
"""
|
71 |
+
## Automatically converting web screenshots to html codes !
|
72 |
+
"""
|
73 |
+
)
|
74 |
+
with gr.Row():
|
75 |
+
with gr.Column():
|
76 |
+
screen_shot_upload=gr.Image(type="pil")
|
77 |
+
generate_button=gr.Button(value='Generate')
|
78 |
+
improve_button=gr.Button(value='Self-improve')
|
79 |
+
with gr.Group():
|
80 |
+
with gr.Row():
|
81 |
+
|
82 |
+
chat_input = gr.MultimodalTextbox(interactive=True,
|
83 |
+
file_count="multiple",
|
84 |
+
placeholder="Enter message or upload file...", show_label=False,submit_btn=False,scale=8)
|
85 |
+
#repolish_system_text=gr.Text()
|
86 |
+
repolish_button=gr.Button(value='Repolish',scale=2)
|
87 |
+
|
88 |
+
with gr.Tab("Source"):
|
89 |
+
source_area=gr.TextArea(value=default_source,interactive=True,label='html source',lines=35)
|
90 |
+
render_button=gr.Button(value='Rerender')
|
91 |
+
|
92 |
+
with gr.Tab('Preview'):
|
93 |
+
with gr.Row():
|
94 |
+
html_area = iFrame(value=default_source,height=800)
|
95 |
+
|
96 |
+
with gr.Tab('Debug'):
|
97 |
+
chat_area = gr.Chatbot(
|
98 |
+
elem_id="chatbot",
|
99 |
+
bubble_full_width=False,
|
100 |
+
scale=1,
|
101 |
+
)
|
102 |
+
|
103 |
+
#chat_input = gr.MultimodalTextbox(interactive=True,
|
104 |
+
# file_count="multiple",
|
105 |
+
# placeholder="Enter message or upload file...", show_label='ergergergr')
|
106 |
+
|
107 |
+
#chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
108 |
+
#bot_msg = chat_msg.then(bot, chatbot, chatbot, api_name="bot_response")
|
109 |
+
|
110 |
+
|
111 |
+
screen_shot_upload.change(process_inputs,inputs=[session_state,screen_shot_upload],outputs=[session_state])
|
112 |
+
generate_button.click(generate_code,inputs=[session_state],outputs=[source_area,html_area,session_state])
|
113 |
+
improve_button.click(improve_code,inputs=[session_state],outputs=[source_area,html_area,session_state])
|
114 |
+
render_button.click(render,inputs=[session_state,source_area],outputs=[session_state,html_area])
|
115 |
+
repolish_button.click(repolish,inputs=[session_state,chat_input],outputs=[html_area,source_area])
|
116 |
+
return demo
|
117 |
+
|
prompts.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
the banner of current page isn't in the bottom and it has no gray color. Fix these in the source code please!
|
2 |
+
|
3 |
+
the banner of current page isn't in the bottom right or left. Fix these in the source code class <footer> dividing them into servel component in the left or right
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
gradio==4.43.0
|
2 |
+
pillow==10.4.0
|
3 |
+
openai==1.44.0
|
test.py
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import plotly.express as px
|
3 |
+
|
4 |
+
# Chatbot demo with multimodal input (text, markdown, LaTeX, code blocks, image, audio, & video). Plus shows support for streaming text.
|
5 |
+
|
6 |
+
def random_plot():
|
7 |
+
df = px.data.iris()
|
8 |
+
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
|
9 |
+
size='petal_length', hover_data=['petal_width'])
|
10 |
+
return fig
|
11 |
+
|
12 |
+
def print_like_dislike(x: gr.LikeData):
|
13 |
+
print(x.index, x.value, x.liked)
|
14 |
+
|
15 |
+
def add_message(history, message):
|
16 |
+
for x in message["files"]:
|
17 |
+
history.append(((x,), None))
|
18 |
+
if message["text"] is not None:
|
19 |
+
history.append((message["text"], None))
|
20 |
+
return history, gr.MultimodalTextbox(value=None, interactive=False)
|
21 |
+
|
22 |
+
def bot(history):
|
23 |
+
history[-1][1] = "Cool!"
|
24 |
+
return history
|
25 |
+
|
26 |
+
fig = random_plot()
|
27 |
+
|
28 |
+
with gr.Blocks(fill_height=True) as demo:
|
29 |
+
chatbot = gr.Chatbot(
|
30 |
+
elem_id="chatbot",
|
31 |
+
bubble_full_width=False,
|
32 |
+
scale=1,
|
33 |
+
)
|
34 |
+
|
35 |
+
chat_input = gr.MultimodalTextbox(interactive=True,
|
36 |
+
file_count="multiple",
|
37 |
+
placeholder="Enter message or upload file...", show_label=False)
|
38 |
+
|
39 |
+
chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
40 |
+
bot_msg = chat_msg.then(bot, chatbot, chatbot, api_name="bot_response")
|
41 |
+
bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])
|
42 |
+
|
43 |
+
chatbot.like(print_like_dislike, None, None)
|
44 |
+
|
45 |
+
if __name__ == "__main__":
|
46 |
+
demo.launch()
|
utils/debug.py
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
|
4 |
+
def log_chat(history):
|
5 |
+
pass
|
utils/tools.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from PIL import Image
|
2 |
+
import base64
|
3 |
+
import io
|
4 |
+
from typing import Union
|
5 |
+
import yaml
|
6 |
+
|
7 |
+
def txt2string(path):
|
8 |
+
with open(path, 'r', encoding='utf-8') as file:
|
9 |
+
file_content = file.read()
|
10 |
+
return file_content
|
11 |
+
|
12 |
+
|
13 |
+
def base64_convert(image):
|
14 |
+
if isinstance(image,str):
|
15 |
+
img=Image.open(image)
|
16 |
+
|
17 |
+
buffered = io.BytesIO()
|
18 |
+
img.save(buffered, format="PNG")
|
19 |
+
img_str = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
20 |
+
else:
|
21 |
+
buffered = io.BytesIO()
|
22 |
+
image.save(buffered, format="PNG")
|
23 |
+
img_str = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
24 |
+
|
25 |
+
return img_str
|
26 |
+
|
27 |
+
|
28 |
+
def readable_history(history):
|
29 |
+
'''remove picture in history to make it readable.'''
|
30 |
+
pass
|
31 |
+
|
32 |
+
|
33 |
+
def load_config():
|
34 |
+
# Open the YAML file
|
35 |
+
with open('./config.yaml', 'r') as file:
|
36 |
+
# Load the contents of the file
|
37 |
+
config = yaml.safe_load(file)
|