Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -89,6 +89,18 @@ def main():
|
|
| 89 |
|
| 90 |
# Second column: Display generated code
|
| 91 |
with col2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
code_result = extract_code_from_output(result)
|
| 93 |
if option == "gorilla-7b-hf-v1":
|
| 94 |
st.subheader("Output Generated")
|
|
|
|
| 89 |
|
| 90 |
# Second column: Display generated code
|
| 91 |
with col2:
|
| 92 |
+
def extract_code_from_output(result):
|
| 93 |
+
if result is not None:
|
| 94 |
+
output = result.stdout
|
| 95 |
+
if output is not None and "code>>>:" in output:
|
| 96 |
+
code = output.split("code>>>:")[1]
|
| 97 |
+
return code
|
| 98 |
+
return None # or handle the case when code extraction is not successful
|
| 99 |
+
|
| 100 |
+
# Example usage:
|
| 101 |
+
result = ... # your result variable
|
| 102 |
+
code_result = extract_code_from_output(result)
|
| 103 |
+
|
| 104 |
code_result = extract_code_from_output(result)
|
| 105 |
if option == "gorilla-7b-hf-v1":
|
| 106 |
st.subheader("Output Generated")
|