当前位置:网站首页>Fast implementation of "writing poems for you" (alicloud ECS) based on function computing

Fast implementation of "writing poems for you" (alicloud ECS) based on function computing

2020-12-08 10:15:24 osc_ tc7vil4d

brief introduction

Through a few simple lines of instruction , Deploy your own expressive artifact , Write poems for loved ones with technology , Will the verse , Organize it into pictures , Send it to your beloved Ta.

Alicloud experience Lab address ( Not yet purchased ECS You can experience it here )
https://developer.aliyun.com/adc/scenario/c6415182ebba4c9f990c2298e9a73eba

Step one : Connect ECS The server

1. Open the terminal tool provided by the system .

  • Windows:CMD or Powershell.
  • MAC:Terminal.

2. Enter the connection command in the terminal ssh [username]@[ipaddress]. You need to put username and ipaddress Replace with 1 Created in the section ECS Login name and public address of the server . for example :

ssh root@123.123.123.123

 Insert picture description here
The command displays the following results :
 Insert picture description here

  1. Input yes.
  2. If you agree to continue, you will be prompted to enter your login password . The password is for the created cloud service ECS Login password for .
     Insert picture description here
    After successful login, the following information will be displayed .
     Insert picture description here


Step two : Download command line tools

1. Install as follows Node.js Environmental Science .
a. download Node.js Installation package .

wget https://npm.taobao.org/mirrors/node/v12.4.0/node-v12.4.0-linux-x64.tar.xz
b.   Unzip the installation package and rename .
tar -xvf node-v12.4.0-linux-x64.tar.xz && mv node-v12.4.0-linux-x64/ /usr/local/node
c.   Configure environment variables .
echo "export PATH=$PATH:/usr/local/node/bin" >> /etc/profile
source /etc/profile

2. Execute the following command in the command line terminal to install Serverless-Devs Tools .

npm install @serverless-devs/s -g

The command execution results are similar to the following .
 Insert picture description here
explain : If the installation process is slow , You can use Taobao npm Source , The installation command is

npm --registry=https://registry.npm.taobao.org install @serverless-devs/s -g

3. Execute the view version command to check the installation .

s -v

The command execution results are similar to the following .
 Insert picture description here

Step three : Configure alicloud account information

explain : The experience scene provides free ECS The server , But the function calculation service used is under your own account , The following configuration information also needs to configure your own account UID、AKID and AKSecret Information .
Execute the following account information configuration command .

s config add

Then fill in the following information according to the prompts .

  • Cloud manufacturers : Choose alicloud (alibaba).
  • AccountID: Sign in Alicloud function computing console You can view your alicloud main account ID.
     Insert picture description here
  • AccessKeyID and AccessKeySecret: stay AccessKey Management page click see Secret You can view the key information .
     Insert picture description here
    After the configuration is successful, the display is similar to the following .
     Insert picture description here


Step four : Project deployment

1. Initialize a template project

s init fc-poem -p alibaba

2. Entry project

cd fc-poem

3. perform :s deploy Command to deploy
thus , Completed the simple function deployment function .

Wait a little while for the deployment to succeed , After successful deployment, a temporary domain name will be generated , You can copy the temporary domain name for access testing .
 Insert picture description here

Step five : Project experience

Open our path address in the browser
 Insert picture description here
Write in the input box , Then click to generate ancient poetry , Wait a moment ( If not successfully generated , Or no results for a long time , You can click again to generate ), And then you can see the ancient poetry generated , Click generate image to see picture :
 Insert picture description here


Step six : Train of thought expansion

Although it is said that a simple picture is generated , But actually , This is an artificial intelligence + Image processing projects .
Part of it is about artificial intelligence : This is through the training of the model , And then through user input , Create an ancient poem , This part of the model also runs on the function calculation of Alibaba cloud , But because the model is too large, it may require NAS etc. , So we haven't been taught how to deploy this model , Instead, it provides an interface directly for you to use . So you can go through the most simple , The quickest way to experience this project .
Of course , In the process of using , You can also modify the code yourself , Replace the picture , It's just a process of throwing a brick to attract jade .
Ancient poetry is just AI Generated by reasoning , Whether it has high literary value , I'm not very good at this , Can't judge , But I believe , With the development of the times , The model will be more and more perfect . I believe more in , With Serverless Continuous development , There's going to be more of this , More interesting little app . This time it is Serverless Write poems for you , Next time ? Looking forward to the " imagination "!


版权声明
本文为[osc_ tc7vil4d]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201208101514553a.html