Spaces:
Sleeping
Sleeping
Create mycomponent/__init__.py
Browse files- mycomponent/__init__.py +18 -0
mycomponent/__init__.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import streamlit.components.v1 as components
|
| 3 |
+
|
| 4 |
+
_RELEASE = True
|
| 5 |
+
|
| 6 |
+
if not _RELEASE:
|
| 7 |
+
_component_func = components.declare_component(
|
| 8 |
+
"speech_recognition",
|
| 9 |
+
url="http://localhost:3001",
|
| 10 |
+
)
|
| 11 |
+
else:
|
| 12 |
+
parent_dir = os.path.dirname(os.path.abspath(__file__))
|
| 13 |
+
build_dir = os.path.join(parent_dir, "frontend/build")
|
| 14 |
+
_component_func = components.declare_component("speech_recognition", path=parent_dir)
|
| 15 |
+
|
| 16 |
+
def speech_recognition(key=None):
|
| 17 |
+
"""Create a speech recognition component instance."""
|
| 18 |
+
return _component_func(key=key)
|