Update run ui script to allow presets + update streamlit to accept them (#30)

This commit is contained in:
Suchintan 2024-03-05 13:57:18 -05:00 committed by GitHub
parent fb3a90dd78
commit 6ff91411fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 4 deletions

View file

@ -147,8 +147,16 @@ Preload these examples inside of our UI so that users can see them in action
Provide a way to run these examples in the UI (via the commandline?) -->
We love to see how Skyvern is being used in the wild. Here are some examples of how Skyvern is being used to automate workflows in the real world. Please open PRs to add your own examples!
You'll need to have Skyvern running locally if you want to try these examples out. Please run the following command after going through the quickstart guide:
```
./run_skyvern.sh
```
## Automate materials procurement for a manufacturing company
💡 See it in action
```
./run_ui.sh finditparts
```
<p align="center">
<img src="images/finditparts_recording_crop.gif"/>
</p>
@ -162,6 +170,11 @@ We love to see how Skyvern is being used in the wild. Here are some examples of
<p align="center">
<img src="images/bci_seguros_recording.gif"/>
</p>
💡 See it in action
```
./run_ui.sh geico
```
<p align="center">
<img src="images/geico_shu_recording_cropped.gif"/>
</p>

View file

@ -1,3 +1,5 @@
source "$(poetry env info --path)/bin/activate"
python scripts/tracking.py skyvern-oss-run-ui
streamlit run streamlit_app/visualizer/streamlit.py
streamlit run streamlit_app/visualizer/streamlit.py -- $@

View file

@ -1,3 +1,5 @@
import sys
import clipboard
import pandas as pd
import streamlit as st
@ -20,6 +22,8 @@ st.set_page_config(layout="wide")
st.markdown(styles.page_font_style, unsafe_allow_html=True)
st.markdown(styles.button_style, unsafe_allow_html=True)
tab_name = sys.argv[1] if len(sys.argv) > 1 else ""
# Configuration
def reset_session_state() -> None:
@ -111,14 +115,18 @@ def copy_curl_to_clipboard(task_request_body: TaskRequest) -> None:
with execute_tab:
example_tabs = st.tabs([supported_example.name for supported_example in supported_examples])
# Streamlit doesn't support "focusing" on a tab, so this is a workaround to make the requested tab be the "first" tab
sorted_supported_examples = sorted(
supported_examples, key=lambda x: (-1 if x.name.lower() == tab_name.lower() else 0)
)
example_tabs = st.tabs([supported_example.name for supported_example in sorted_supported_examples])
for i, example_tab in enumerate(example_tabs):
with example_tab:
create_column, explanation_column = st.columns([1, 2])
with create_column:
run_task, copy_curl = st.columns([3, 1])
task_request_body = supported_examples[i]
task_request_body = sorted_supported_examples[i]
unique_key = f"{task_request_body.name}"
copy_curl.button(
@ -129,7 +137,7 @@ with execute_tab:
with st.form(f"task_form_{unique_key}"):
run_task.markdown("## Run a task")
example = supported_examples[i]
example = sorted_supported_examples[i]
# Create all the fields to create a TaskRequest object
st_url = st.text_input("URL*", value=example.url, key=f"url_{unique_key}")
st_webhook_callback_url = st.text_input(