You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importstreamlitasstimportasynciofromaiconfigimportAIConfigRuntimeasyncdefmain():
print("hey I ot here")
config=AIConfigRuntime.load('test_wedding planner.aiconfig.json')
model_output=awaitconfig.run('prompt_1')
print(model_output)
# st.title('AI Wedding Planner')# # Input form# with st.form("wedding_planner_form"):# st.write("Please provide details about your wedding to get personalized advice.")# location = st.text_input("Location (city, country):")# budget = st.number_input("Budget (in USD):", min_value=1000, max_value=100000, step=500)# #no of guests, food preferences, style or theme of wedding, no of functions, season(spring, summer, winter, fall)# query = st.text_area("What do you need help with? For example, 'I'm looking for rustic wedding theme ideas.'")# submit_button = st.form_submit_button("Get Advice")# if submit_button:# advice = get_wedding_planning_advice(location, budget, query)# structured_advice = advice.split('\n')# structured_advice = [line for line in structured_advice if line.strip() != '']# for item in structured_advice:# st.markdown(f"- {item}")if__name__=="__main__":
asyncio.run(main())
Error stacktrace:
(streamlitenv) (base) Aruns-MacBook-Pro-2:Streamlit AI arunchavan$ streamlit run app.py
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
Network URL: http://192.168.1.176:8501
For better performance, install the Watchdog module:
$ xcode-select --install
$ pip install watchdog
/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/pydantic/_internal/_fields.py:151: UserWarning: Field "model_parsers" has conflict with protected namespace "model_".
You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
warnings.warn(
2024-03-11 18:48:48.662 Uncaught app exception
Traceback (most recent call last):
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
exec(code, module.__dict__)
File "/Users/arunchavan/Desktop/Streamlit AI/app.py", line 52, in <module>
asyncio.run(main())
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/arunchavan/Desktop/Streamlit AI/app.py", line 31, in main
model_output = await config.run('prompt_1')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/aiconfig/Config.py", line 332, in run
response = await model_provider.run(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/aiconfig/default_parsers/parameterized_model_parser.py", line 56, in run
return await self.run_inference(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/aiconfig/default_parsers/openai.py", line 319, in run_inference
completion_data = await self.deserialize(prompt, aiconfig, parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/aiconfig/default_parsers/openai.py", line 274, in deserialize
add_prompt_as_message(
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/aiconfig/default_parsers/openai.py", line 578, in add_prompt_as_message
resolved_prompt = resolve_prompt(prompt, params, aiconfig)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/aiconfig/util/params.py", line 292, in resolve_prompt
return resolve_prompt_string(
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/aiconfig/util/params.py", line 341, in resolve_prompt_string
return resolve_parametrized_prompt(prompt_string, combined_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/aiconfig/util/params.py", line 123, in resolve_parametrized_prompt
template = compiler.compile(raw_prompt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/pybars/_compiler.py", line 892, in compile
container = self._generate_code(source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/pybars/_compiler.py", line 838, in _generate_code
output = self._compiler(tree).apply('compile')[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/pymeta/runtime.py", line 299, in apply
val, err = self._apply(r, ruleName, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/pymeta/runtime.py", line 329, in _apply
[rule(), self.input])
^^^^^^
File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 11, in rule_compile
self.considerError(lastError)
^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/pymeta/runtime.py", line 396, in many
v, _ = fn()
^^^^
File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 8, in _G_many_2
_G_exactly_1, lastError = self.exactly('-')
^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/pymeta/runtime.py", line 329, in _apply
[rule(), self.input])
^^^^^^
File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 63, in rule_rule
_G_python_3, lastError = eval("int('0'+''.join(ds), 8)", self.globals, _locals), None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/pymeta/runtime.py", line 414, in _or
ret, err = f()
^^^
File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 32, in _G_or_1
_G_exactly_1, lastError = self.exactly('0')
^^^^^^^^^^^^^^^^^^^^
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/pymeta/runtime.py", line 329, in _apply
[rule(), self.input])
^^^^^^
File "/pymeta_generated_code/pymeta_grammar__Grammar.py", line 152, in rule_literal
self.considerError(lastError)
^^^^^^^^^
File "<string>", line 1, in <module>
File "/Users/arunchavan/anaconda3/envs/streamlitenv/lib/python3.11/site-packages/pybars/_compiler.py", line 611, in add_literal
self._result.grow(u" result.append(%s)\n" % repr(value))
^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'grow'
[ExecuteResult(output_type='execute_result', execution_count=0, data='1. The Liberty Hotel\n2. The State Room\n3. Taj Boston\n4. The Lenox Hotel\n5. Fairmont Copley Plaza\n6. The Harvard Club of Boston\n7. John F. Kennedy Presidential Library and Museum\n8. The Bostonian Boston\n9. Boston Marriott Long Wharf\n10. The Exchange Conference Center', mime_type=None, metadata={'id': 'chatcmpl-91ijrtxBidtbD7xgv2GudFaC7Kp7t', 'created': 1710197331, 'model': 'gpt-3.5-turbo-0125', 'object': 'chat.completion.chunk', 'system_fingerprint': 'fp_4f0b692a78', 'raw_response': {'content': '1. The Liberty Hotel\n2. The State Room\n3. Taj Boston\n4. The Lenox Hotel\n5. Fairmont Copley Plaza\n6. The Harvard Club of Boston\n7. John F. Kennedy Presidential Library and Museum\n8. The Bostonian Boston\n9. Boston Marriott Long Wharf\n10. The Exchange Conference Center', 'role': 'assistant'}, 'role': 'assistant'})]
[ExecuteResult(output_type='execute_result', execution_count=0, data='1. The Liberty Hotel\n2. State Room\n3. Boston Park Plaza\n4. Omni Parker House\n5. The Bostonian Boston\n6. The Harvard Club of Boston\n7. The Taj Boston\n8. The Lenox Hotel\n9. The Fairmont Copley Plaza\n10. The Hampshire House', mime_type=None, metadata={'id': 'chatcmpl-91ijqiIqSWJ1QTp4EQe360PNW9xz9', 'created': 1710197330, 'model': 'gpt-3.5-turbo-0125', 'object': 'chat.completion.chunk', 'system_fingerprint': 'fp_4f0b692a78', 'raw_response': {'content': '1. The Liberty Hotel\n2. State Room\n3. Boston Park Plaza\n4. Omni Parker House\n5. The Bostonian Boston\n6. The Harvard Club of Boston\n7. The Taj Boston\n8. The Lenox Hotel\n9. The Fairmont Copley Plaza\n10. The Hampshire House', 'role': 'assistant'}, 'role': 'assistant'})]
^C Stopping...
^C
The text was updated successfully, but these errors were encountered:
Works perfectly fine if doing
python app.py
, but if we try doingstreamlit run app.py
it breaksRead-only of AIConfig: https://lastmileai.dev/aiconfig/cltnjmn0u00b4qyu1ngn6nnkc
Code:
Error stacktrace:
The text was updated successfully, but these errors were encountered: