Yasu777 commited on
Commit
6c8ec8a
·
verified ·
1 Parent(s): a998b84

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -7,8 +7,14 @@ from streamlit.components.v1 import declare_component
7
  groq_api_key = os.getenv('GROQ_API_KEY')
8
  client = Groq(api_key=groq_api_key)
9
 
 
 
 
 
 
 
10
  # カスタムReactコンポーネントの宣言
11
- react_component = declare_component("react_component", path="frontend/build")
12
 
13
  st.title("Advanced Artifact Prototype with Groq and LLaMA 3")
14
 
@@ -57,5 +63,6 @@ if st.button("Generate"):
57
  st.components.v1.html(response, height=600)
58
  elif artifact_type == "application/vnd.ant.react":
59
  # Reactコンポーネントをレンダリング
60
- react_component("ReactComponent", {"code": response})
61
  st.code(response, language="javascript")
 
 
7
  groq_api_key = os.getenv('GROQ_API_KEY')
8
  client = Groq(api_key=groq_api_key)
9
 
10
+ # 現在のファイルのディレクトリを取得
11
+ current_dir = os.path.dirname(os.path.abspath(__file__))
12
+
13
+ # buildディレクトリの絶対パスを作成
14
+ build_dir = os.path.join(current_dir, "frontend/build")
15
+
16
  # カスタムReactコンポーネントの宣言
17
+ react_component = declare_component("react_component", path=build_dir)
18
 
19
  st.title("Advanced Artifact Prototype with Groq and LLaMA 3")
20
 
 
63
  st.components.v1.html(response, height=600)
64
  elif artifact_type == "application/vnd.ant.react":
65
  # Reactコンポーネントをレンダリング
66
+ react_component(name="ReactComponent", code=response)
67
  st.code(response, language="javascript")
68
+