hasanalrobasi commited on
Commit
f754138
·
verified ·
1 Parent(s): 080ef1b

Upload streamlit_app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. streamlit_app.py +4 -9
streamlit_app.py CHANGED
@@ -1,11 +1,11 @@
1
  import streamlit as st
2
- from daggr import GradioNode, InferenceNode, FnNode, Graph
3
  import gradio as gr
4
  from typing import Dict, Any
5
- import requests
6
  import os
7
  import time
8
  from datetime import datetime
 
9
 
10
  # Set page config
11
  st.set_page_config(
@@ -21,12 +21,6 @@ st.sidebar.markdown("[Built with anycoder](https://huggingface.co/spaces/akhaliq
21
  if 'workflow_results' not in st.session_state:
22
  st.session_state.workflow_results = None
23
 
24
- # Environment variables for API keys
25
- API_KEYS = {
26
- "OPENAI": os.getenv("OPENAI_API_KEY"),
27
- "HUGGINGFACE": os.getenv("HF_API_KEY")
28
- }
29
-
30
  # ========== Nodes Definition ==========
31
  def preprocess_inputs(user_input: str, metadata: Dict[str, Any]) -> Dict[str, Any]:
32
  """Clean and validate inputs with metadata enrichment"""
@@ -181,7 +175,7 @@ with st.form("workflow_form"):
181
  # Prepare inputs
182
  inputs = {
183
  "user_input": user_input,
184
- "metadata": metadata,
185
  "temperature": temperature,
186
  "steps": steps
187
  }
@@ -189,6 +183,7 @@ with st.form("workflow_form"):
189
  # Execute workflow
190
  results = workflow.run(inputs)
191
  st.session_state.workflow_results = results
 
192
 
193
  st.success("Workflow completed successfully!")
194
 
 
1
  import streamlit as st
2
+ from daggr import FnNode, Graph
3
  import gradio as gr
4
  from typing import Dict, Any
 
5
  import os
6
  import time
7
  from datetime import datetime
8
+ from utils import validate_metadata, log_workflow
9
 
10
  # Set page config
11
  st.set_page_config(
 
21
  if 'workflow_results' not in st.session_state:
22
  st.session_state.workflow_results = None
23
 
 
 
 
 
 
 
24
  # ========== Nodes Definition ==========
25
  def preprocess_inputs(user_input: str, metadata: Dict[str, Any]) -> Dict[str, Any]:
26
  """Clean and validate inputs with metadata enrichment"""
 
175
  # Prepare inputs
176
  inputs = {
177
  "user_input": user_input,
178
+ "metadata": validate_metadata(metadata),
179
  "temperature": temperature,
180
  "steps": steps
181
  }
 
183
  # Execute workflow
184
  results = workflow.run(inputs)
185
  st.session_state.workflow_results = results
186
+ log_workflow(results)
187
 
188
  st.success("Workflow completed successfully!")
189