Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,10 @@
|
|
| 1 |
-
# Import necessary packages
|
| 2 |
-
import os
|
| 3 |
from ibm_watson_machine_learning.foundation_models import Model
|
| 4 |
from ibm_watson_machine_learning.metanames import GenTextParamsMetaNames as GenParams
|
| 5 |
from ibm_watson_machine_learning.foundation_models.utils.enums import ModelTypes, DecodingMethods
|
| 6 |
-
import gradio as gr
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
watsonx_API =
|
| 10 |
-
project_id
|
| 11 |
|
| 12 |
generate_params = {
|
| 13 |
GenParams.MAX_NEW_TOKENS: 250
|
|
@@ -27,4 +24,3 @@ q = "How to be happy?"
|
|
| 27 |
generated_response = model.generate(prompt=q)
|
| 28 |
print(generated_response['results'][0]['generated_text'])
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
| 1 |
from ibm_watson_machine_learning.foundation_models import Model
|
| 2 |
from ibm_watson_machine_learning.metanames import GenTextParamsMetaNames as GenParams
|
| 3 |
from ibm_watson_machine_learning.foundation_models.utils.enums import ModelTypes, DecodingMethods
|
|
|
|
| 4 |
|
| 5 |
+
# Set up the API key and project ID for IBM Watson
|
| 6 |
+
watsonx_API = "Q7fLgZsmjZJ9L8BhLE_asx91M1C3dlPeYgmSm2wBleyk" # below is the instruction how to get them
|
| 7 |
+
project_id= "a5a13c69-59c8-4856-bea6-4fa1f85e2cbb" # like "0blahblah-000-9999-blah-99bla0hblah0"
|
| 8 |
|
| 9 |
generate_params = {
|
| 10 |
GenParams.MAX_NEW_TOKENS: 250
|
|
|
|
| 24 |
generated_response = model.generate(prompt=q)
|
| 25 |
print(generated_response['results'][0]['generated_text'])
|
| 26 |
|
|
|