File tree Expand file tree Collapse file tree 14 files changed +70
-71
lines changed Expand file tree Collapse file tree 14 files changed +70
-71
lines changed Original file line number Diff line number Diff line change @@ -101,18 +101,14 @@ ci-test-docker: docker-compose-lint ## run CI test for Docker
101101# ---
102102# Application
103103# ---
104- SOLUTION_NAME ?= "SANDBOX"
105- BACKEND_URL ?= "http://localhost:8000"
106-
107104.PHONY : backend
108105backend : # # run backend
109106 poetry run python main.py backend --reload
110107
111108.PHONY : frontend
112109frontend : # # run frontend
113- poetry run streamlit run main.py -- frontend -- \
114- --solution-name=$(SOLUTION_NAME ) \
115- --backend-url=$(BACKEND_URL )
110+ cd frontend \
111+ && poetry run streamlit run main.py
116112
117113# ---
118114# Azure Functions
File renamed without changes.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import streamlit as st
2+
3+
4+ def init_page ():
5+ st .set_page_config (page_title = "Azure AI Solutions" , page_icon = "🧐" )
6+
7+
8+ def main ():
9+ init_page ()
10+
11+ st .sidebar .success ("Please select apps from the sidebar menu" )
12+
13+ st .markdown (
14+ """
15+ ### Welcome to Azure AI Solutions
16+
17+ - This app shows some use cases with Azure AI Services
18+ - Got to the pages from the left menu
19+ """
20+ )
21+
22+
23+ if __name__ == "__main__" :
24+ main ()
Original file line number Diff line number Diff line change 44from urllib .parse import urljoin
55
66import streamlit as st
7-
8- from frontend .solutions .utilities import http_post_file
7+ from utilities import http_post_file
98
109logger = logging .getLogger (__name__ )
1110
1211
13- def start (
12+ def main (
1413 backend_url : str ,
1514 log_level : int ,
1615):
@@ -43,3 +42,10 @@ def start(
4342 st .write (response )
4443 else :
4544 st .warning ("Please upload a file first" )
45+
46+
47+ if __name__ == "__main__" :
48+ main (
49+ backend_url = "http://localhost:8000" ,
50+ log_level = logging .DEBUG ,
51+ )
Original file line number Diff line number Diff line change 66from openai import AzureOpenAI
77
88logger = logging .getLogger (__name__ )
9- load_dotenv ("./settings/frontend.env" )
9+ load_dotenv ()
1010
1111
12- def start (
12+ def main (
1313 backend_url : str ,
1414 log_level : int ,
1515):
@@ -52,3 +52,10 @@ def start(
5252 assistant_text += content
5353 placeholder .write (assistant_text )
5454 st .session_state .messages .append ({"role" : "assistant" , "content" : assistant_text })
55+
56+
57+ if __name__ == "__main__" :
58+ main (
59+ backend_url = "http://localhost:8000" ,
60+ log_level = logging .DEBUG ,
61+ )
Original file line number Diff line number Diff line change 44from urllib .parse import urljoin
55
66import streamlit as st
7-
8- from frontend .solutions .utilities import http_post_file
7+ from utilities import http_post_file
98
109logger = logging .getLogger (__name__ )
1110
1211
13- def start (
12+ def main (
1413 backend_url : str ,
1514 log_level : int ,
1615):
@@ -41,3 +40,10 @@ def start(
4140 )
4241 )
4342 st .write (response )
43+
44+
45+ if __name__ == "__main__" :
46+ main (
47+ backend_url = "http://localhost:8000" ,
48+ log_level = logging .DEBUG ,
49+ )
Original file line number Diff line number Diff line change 33from urllib .parse import urljoin
44
55import streamlit as st
6-
7- from frontend .solutions .utilities import http_get
6+ from utilities import http_get
87
98logger = logging .getLogger (__name__ )
109
@@ -34,7 +33,7 @@ async def chat_completions_post(
3433 return response .content
3534
3635
37- def start (
36+ def main (
3837 backend_url : str ,
3938 log_level : int ,
4039):
@@ -75,3 +74,10 @@ def start(
7574 except Exception as e :
7675 st .write (f"Error: { e } " )
7776 logger .error (f"Error: { e } " )
77+
78+
79+ if __name__ == "__main__" :
80+ main (
81+ backend_url = "http://localhost:8000" ,
82+ log_level = logging .DEBUG ,
83+ )
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def get_transcription(file_path: str) -> Transcription:
2525 )
2626
2727
28- def start (
28+ def main (
2929 backend_url : str ,
3030 log_level : int ,
3131):
@@ -63,3 +63,10 @@ def start(
6363 # Get transcription
6464 transcription = get_transcription (audio_file_path )
6565 st .write (f"Transcription: { transcription .text } " )
66+
67+
68+ if __name__ == "__main__" :
69+ main (
70+ backend_url = "http://localhost:8000" ,
71+ log_level = logging .DEBUG ,
72+ )
You can’t perform that action at this time.
0 commit comments